ref: f4da816bf3faa3aca914af1a48c93b3c5b7f8892
dir: /revert/
#!/bin/rc rfork e . /sys/lib/git/common.rc usage=' git/revert [-c query] file... -c revert to commit "query" (default: HEAD) ' rel=`{pwd} gitup commit=/mnt/git/HEAD while(~ $1 -* && ! ~ $1 --){ switch($1){ case -c; commit=`{git/query -p $2} shift case *; usage } shift } if(~ $#* 0) usage rel=`{echo $rel | sed 's@^'$gitroot'/?@@'} if(~ $#rel 0) rel='' for(f in `$nl{cd $commit/tree/ && walk -f ./$rel/$*}){ mkdir -p `{basename -d $f} cp -- $commit/tree/$f $f }