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 just wanted to push to my personal branch which went through just fine, but it also tried to push to master and got rejected. Looked something like this:
foo$ git push
Counting objects: 38, done.
Delta compression using 2 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (21/21), 9.73 KiB, done.
Total 21 (delta 14), reused 0 (delta 0)
To ssh://example.com/project.git
8184634..86b621e mybranch -> mybranch
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to 'ssh://example.com/project.git'
My config looks like this:
remote.origin.url=ssh://example.com/project.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
branch.mybranch.remote=origin
branch.mybranch.merge=refs/heads/mybranch
Esko notes that it's pushing to both because they're in my config. What if I want to push to both, just not simultaneously? When I have mybranch checked out and I git push, I clearly mean to push mybranch and not master. There's times when I'll checkout master, edit code, and want to commit/push that also. Is there a way for both to co-exist?