Re: Git terminology: remote, add, track, stage, etc.
- From
Michael Haggerty <mhagger@alum.mit.edu>
- Date
- Oct 21, 2010, 08:44 UTC
- Message-ID
- <4CBFFD79.1010808@alum.mit.edu>
- In-Reply-To
- <m3ocar5fmo.fsf@localhost.localdomain>
On 10/18/2010 11:57 PM, Jakub Narebski wrote:
Show 6 quoted lines
> Well, there is different suggestion: make `git stage`, `git track` and > `git mark-resolved` to be *specializations* of `git add`, with added > safety checks: 'git stage' would work only on files known to git / > under version control already, 'git track' would work only on > untracked files (and do what 'git add -N' does), and 'git mark-resolved' > would work only on files which were part of a merge conflict.
I think that is a great idea. The thing that I found most confusing when learning git is that variations on a single command often have very different effects. My pet peeve is the over-versatile "git checkout":
git checkout BRANCH : Check out a branch. This is the functionality that I would expect from a "checkout" command.
git checkout -b NEWBRANCH OLDBRANCH : For me this was unintuitive, because (IMO) the main effect of the command is to create a new branch. (I consider that more significant than the checkout because it has a persistent effect on the repository.) Therefore, I would expect this functionality to be provided by "git branch" (something like "git branch --checkout NEWBRANCH OLDBRANCH").
git checkout -b NEWBRANCH : This is even more unintuitive, because no content is being checked out at all. This should be written "git branch --checkout NEWBRANCH".
git checkout -- PATH : To me this is again a totally different operation. The other uses of "git checkout" are safe; they don't lose any information. But this usage discards the working copy changes irretrievably. Such a different operation deserves a different command with a "dangerous-sounding" name. I think this functionality should be made more easily accessible via "git reset", as has been suggested elsewhere on this thread. (Unfortunately "git revert" is already taken.)
git checkout BRANCH -- PATH : This is even more perverse. Usually "check out" makes the working copy more similar to a version in the repository. But this command makes it more different.
Michael
-- Michael Haggerty mhagger@alum.mit.edu http://softwareswirl.blogspot.com/