3 ms·
> like why does 'git push' push just the current branch, and 'git pull' pull all branches? It's the opposite, "git push" pushes all branches and "git pull" onl
by EdiX 14y ago
> like why does 'git push' push just the current branch, and 'git pull' pull all branches?
It's the opposite, "git push" pushes all branches and "git pull" only pulls the current branch. I think it's because push will only do fast-forward merges while pull will do any merge, and that could require a working directory to exist (but why not make push just push the current branch?)
- CJefferson 14y agoSorry yes, I got the asymmetry the wrong way around :) The problem this causes (for me) is that if I have commits in other branches, 'git push' will fail (as other branches can't be fast-forwarded), but 'git pull' won't fix it. Of course, I can get around it, but it's annoying.
- encoderer 14y agoWhat you mean when you say "you can get around it" is just specifying the branch you want to push. Just sayin'. It's not like you have to muck with settings and jump hoops.
- ben_h 14y agoYou can configure `git push` to push just the current branch to its configured remote, by setting 'push.default' to 'upstream'. `git config --global push.default upstream` The relevant docs (droplr'd, since you can't anchor-link into the online manpages): http://d.pr/Rlqn http://d.pr/Rlqn