From: Theodore Tso Date: Wed, 25 Jun 2008 19:50:03 GMT Subject: Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to Message-ID: <20080625195003.GB15077@mit.edu> In-Reply-To: <7v63rx2zwf.fsf@gitster.siamese.dyndns.org> On Wed, Jun 25, 2008 at 10:22:08AM -0700, Junio C Hamano wrote: > Isn't that this? > > #!/bin/sh > exec git checkout HEAD -- "$@" Well, I think you really want this to handle filenames with spaces: for i in $* do git checkout HEAD -- "$i" done I still think it would be nice this as a built-in for "git revert-file" since this is much easier to type than "git checkout HEAD -- " (all those characters and capital letters). But if it ends up being a private shell script for people who do this a lot, that's also fine. I will say that it was not at all obvious that "git checkout" can also be used to revert files, so it wasn't one of the man pages that looked for when trying to figure out how to implement revert files. That's why I ended up using: git show HEAD:$prefix$i > $i - Ted