Thread (28 messages) 28 messages, 11 authors, 2016-06-15

Re: Git terminology: remote, add, track, stage, etc.

From: Michael Haggerty <hidden>
Date: 2016-06-15 22:49:50

On 10/18/2010 11:57 PM, Jakub Narebski wrote:
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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help