2

We've recently adopted our own branch system with Git, but one thing we've been getting frustrated with recently is when trying to commit a change to remote whilst on one branch, Git stops the commit because a different branch is behind its remote counterpart. Therefore, we then have to checkout to each branch that has changed and do a pull first before going back to our original branch to make a commit.

Is there a setting that can prevent Git from stopping commits because of other branches. Is there a certain approach we can take that can prevent the need to have to switch branches?

Joseph Shambrook
  • 320
  • 6
  • 14

1 Answers1

0

Try:

git config --global push.default current

It should avoid the kind of error message mentioned here

error: failed to push some refs to 'git@github.com:jkubicek/my_proj.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. If you did not intend to push that branch, you may want to
hint: specify branches to push or set the 'push.default' configuration
hint: variable to 'current' or 'upstream' to push only the current branch
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • That is the kind of setting, discussed in http://lists-archives.com/git/767304-push-default-current-vs-upstream.html, which lead to new push policy with Git1.7.11+: http://stackoverflow.com/questions/4586687/what-is-the-result-of-git-push-origin/9749477#9749477 – VonC Nov 28 '12 at 09:51