From: Junio C Hamano Date: Mon, 19 Sep 2005 08:25:21 GMT Subject: Re: What to expect after GIT 0.99.7 Message-ID: <7vwtldsbv2.fsf@assigned-by-dhcp.cox.net> In-Reply-To: Matthias Urlichs writes: > Hi, Junio C Hamano wrote: > >> * Perhaps a tool to revert a single file to pre-modification >> state? git-cat-file blob `git-ls-files | grep foo` >foo or >> git-cat-file blob `git-ls-tree HEAD foo` >foo? What should >> the command be called? git-revert is taken so is >> git-checkout. > > git-checkout can be extended to accept filenames, which would have the > additional benefit of enabling me to get any revision, not just HEAD. > > So can git-reset. > > I agree with Anton's "git clean"; with an optional -r > argument, that would be a better solution. It probably is because I am BK untainted, but 'git clean' sounds as if it would do 'git-ls-files --others | xargs rm -f'. I used to do 'cvs update -p foo.c >foo.c', and extending git-checkout may be familiar to cvs migrants. The most roundabout way (albeit with perhaps least typing) is: git-tar-tree HEAD | tar xf - foo.c I originally talked about reverting file(s) in the working tree, but I wonder if reverting a cache (eh, index) entry to the state in a committed tree is useful. read-tree with a pathspec to overwrite index entries for specified paths while leaving others intact. We could think of it as undoing git-update-index.