Git failed to push some refs – the multiple branch variant
Saturday, 19 November 2011
http://ken-blog.krugler.org/2010/02/25/git-failed-to-push-some-refs-the-multiple-branch-variant/
I was having this problem a couple of minutes ago. A couple of interesting comments already there:
your push works, you just get a confusing error about the other branches that git tries to auto-push.
So basically, the push on you branch does work. I checked on github immediatly and it didn’t show, but it could have been just a matter on timing.
And this comment :
For whatever reason, by default git push pushes to all branches on the remote. To set this to the default that you’re expecting (and that really seems the only sane and reasonable default to me, but I digress), you can use git config remote.origin.push HEAD. But meanwhile, since you may wind up using git from other machines and forget that the default behavior is broken, you should probably always just specify the remote and branch explicitly.
So, using your example here, you would use:
git push origin fetch-flow
The problem with this is that if you mistype your branch, you could wind up creating a new branch on the remote with the typo, e.g. something like fletch-flow. So that brings us to what is likely the best git push habit to get into:
git push origin HEAD
This will push only the current branch to a branch of the same name on the remote.