Thread (14 messages) flat view 14 messages, 8 authors, 2016-06-15

Re: Using the --track option when creating a branch

From: Marc Branchaud <hidden>
Date: 2016-06-15 22:45:33

Bill Lear wrote:
the reason being that every manual our users read says "use git push",
use "git pull", the examples being written for 'master' branch usage,
and people just assume that 'git push'/'git pull' are smart enough to
know which branch you are on and do the same logical thing as a bare
'git push'/'git pull' does when on master.
I agree that this is a 'gotcha' for git-push.  I'm a new git user, and 
I've been experimenting with git and reading the documentation for the 
last few weeks.  But I would not have known about this behavior if it 
weren't for this thread.

Yes, push's man page is clear about what happens if you push with no 
refspec, and the fetch & pull man pages both have an obscure note to 
"never do your own development on branches that appear
on the right hand side of a <refspec> colon on 'Pull:' lines".  But 
still the behavior is not what I expected.  Before I read this thread, I 
missed the implications of what those parts of the man pages were saying.

One could call this a failure of the documentation (man pages and 
beyond).  Personally, though, I tend to expect minimal commands to do 
minimal things.  So a plain "git push" would do the minimum amount of 
pushing, and if I want it to do more I'd add extra parameters to the 
command.

The current behavior seems fairly harmless if you always follow the 
pattern of creating topic branches for all your work.  But git (rightly) 
doesn't enforce that pattern, and so I think push shouldn't default to 
doing something potentially harmful just because you forgot to create a 
topic branch one day.  (Or maybe you decided to be clever and give one 
of your local branches the same name as a remote's branch...)

		Marc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help