Pushing a git branch

Tags: django

We’re using git for most django projects now. There’s one big problem I had: if I make a branch and want to push my changes to github, I sometimes get an error complaining that I’m behind on other branches so that my changes can’t be pushed.

The “solution” is to do a git checkout master, pull there (which updates my master pointer), and checkout back to my branch. Now I can push.

This is pretty irritating. Why can’t I just push the branch I’m working on? I found the solution on stackoverflow:

git config --global push.default current

This pushes only the current branch by default. Just what I wanted.