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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/25/08, Theodore Tso <tytso@xxxxxxx> wrote:
> On Wed, Jun 25, 2008 at 10:22:08AM -0700, Junio C Hamano wrote:
>  >         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

"$@" notation actually handles spaces just fine.  It's magic that way.
 On the other hand, "for i in $*" does not, because all the spaces get
split as part of the unquoted $* in "for".  Beware!

>  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.

How about making "git checkout" default to HEAD if no revision is
supplied?  There's precedent for this in, say, git-diff (and I think a
few others).

Incidentally, "checkout <filename>" was also the way to do a revert
operation in CVS.  And the way to switch branches, too, iirc.  So git
isn't being too unusual here.  That said, the commands were
deliberately renamed in svn because CVS was considered largely insane.

Have fun,

Avery
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux