Thread (11 messages) flat view 11 messages, 6 authors, 2016-06-15

Re: [PATCH] cmd_reset: don't trash uncommitted changes unless told to

From: Theodore Tso <tytso@mit.edu>
Date: 2016-06-15 22:44:49

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help