Plan 9 from Bell Labs’s /usr/web/sources/contrib/yk/root/rc/bin/git/revert

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/bin/rc
rfork en
. /rc/bin/git/defs

gitup

flagfmt='c query' args='file ...'
if (! ifs=() eval `{aux/getflags $*} || ~ $#* 0)
	exec aux/usage
query=$flagc

if(~ $#query 0)
	query=HEAD
commit=`{git/query -p $query}

ifs=$nl {
	files=`{cleanname -d $gitrel $* | drop $gitroot}
	walked=`{git/walk -c -fRM -b $query $files}
}
for(f in $walked){
	mkdir -p `{basename -d $f}
	cp -x -- $commit/tree/$f $f
	touch $f
	git/add $f
}
exit ''

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.