shithub: git9

ref: c2ea4015be2695c2115594e301e725dd9cdb0c32
dir: /revert/

View raw version
#!/bin/rc
rfork e
. /sys/lib/git/common.rc

usage='
	git/revert [-c query] file...
		-c        revert to commit "query" (default: HEAD)
'

gitup

commit=/mnt/git/HEAD
while(~ $1 -* && ! ~ $1 --){
	switch($1){
	case -c;
		commit=`{git/query -p $2}
		shift
	case *;
		usage
	}
	shift
}
if(~ $#* 0)
	usage

for(f in `$nl{cd $commit/tree/ && walk -f ./$gitrel/$*}){
	mkdir -p `{basename -d $f}
	cp -- $commit/tree/$f $f
}