What would possibly cause a \'git push\' to try and commit to two branches? I have my own branch I\'m working on, which is on the shared repo... and a master branch. Right now I
When using git push
without any arguments, it will push all local branches that have a corresponding remote branch with the same name. Since your local repository has branches master
and mybranch
, and also the remote repository has branches master
and mybranch
, then Git will push both of them.
If you want to push only one branch, you can say to Git explicitly that which branch you want to push: git push origin mybranch
If you want to push master, you can fix that error by first pulling from master. Git complains about the merge being non-fast forward, because somebody else has pushed a commit to master since the last time that you pulled from master.