On Thu, 27 Jan 2011 02:20:20 -0800 (PST)
Thomas Ferris Nicolaisen <tfn...@gmail.com> wrote:
> Brilliant, that was simpler than I could imagine :)
> Do you know if the dashes are even necessary? Here it worked without
Not necessary as long as Git can figure out you mean a pathname, not
a branch name. In a somewhat odd case, where you have a file or
directory having the same name as a branch (say, "test"), and you would
like to revert the contents of that "test" filesystem object to the
state of HEAD, you would need to force git-checkout to interpret your
"test" command-line argument as being the pathname.
To do this, you have to either use that double-dash thingy or specify
both the name of a branch to get the new contents from (HEAD) and the
name of a filesystem object to revert, that is, both
$ git checkout -- test
$ git checkout HEAD test
would revert the contents of a file/directory named "test" even if
there's a branch named "test".
Note that "--" is a quite common idiom among Unix tools; it usually
forces special interpretation of the arguments following that marker.
In most cases it's used to inhibit interpretation of the following
arguments as options even if they look like options; in the case of
git-checkout it forces interpretation of the following arguments as
You received this message because you are subscribed to the Google Groups "Git
for human beings" group.
To post to this group, send email to email@example.com.
To unsubscribe from this group, send email to
For more options, visit this group at