On Thu, 12 Jul 2012 08:27:59 -0700 PJ Weisberg <[email protected]> wrote:
[...] > git checkout foo.txt > git checkout master > > The first one works like 'svn revert'; the second one works like 'svn > switch'. Hence, checkout works like switch "usually" (for certain > values of "usually", dependent on your usage patterns). > > I haven't looked at Git's innards, but to me those look like two > completely different commands that happen to be spelled exactly the > same. Not a good idea, generally. It doesn't help that one usage is > careful to not overwrite any of your modified files, and the other > usage is specifically intended to overwrite your modified files. Note that the full spec of this (file-level) invocation is git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>… which means it's able to update your work tree files with their contents from the specified tree-ish, not just (implied by default) HEAD. Hence, "reverting" files is just a special application of this more general form. Also, the OP's question was more about "why the hell a thing like this do exist *at all*?" or may be "why it did not ask me whether I really meant to proceed?". I'm inclined to blame the OP in this case: 1) I doubt he had a branch named "." so supposedly he knew what that invocation was about to perform; and playing in a production repo is silly; especially so since creating a throw-away Git repo is so simple; 2) everyone knows asking "are you really sure?" is pointless as the users quickly train themselves to fully automatically click OK/answer "y" etc without even looking. -- 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 protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.
