2

On my production server, I just have master always checked out.

I do git pull, which also updates develop branch.

When I commit to master on the production server, and try to git push, it complains for develop that "non-fast-forward updates were rejected".

How can I deal with master without ever getting problems related to other branches? I don't even want to know about other branches for this local repo.

eoinoc
  • 3,155
  • 3
  • 24
  • 39
  • Could you do `git pull master` instead of `git pull`, so you don't even get those other branches? (I'm still pretty inexperienced with Git, so I don't know whether this would work, but it seems plausible) – Joe White Dec 31 '11 at 12:46

2 Answers2

2

You can specify the branch:

git push origin master

If you don't specify the branch, it goes with what you have in .git/config.

So if you always want to only deal with master on the production server, update the .git/config there removing the other branch associations (so leave the [branch "master"] section but remove the [branch "develop"] section), and then you can just git push again with no arguments.

Ben Lee
  • 52,489
  • 13
  • 125
  • 145
  • Just to note, this worked, but first I had to resolve the non-fastfoward error with `git checkout develop` and `git merge origin/develop` then `git checkout master` before this worked. This makes sense, but just for anyone who later finds this information. – eoinoc Dec 31 '11 at 20:00
0

When you do the git push, specify the branch, i.e.

git push origin master
Stuart Golodetz
  • 20,238
  • 4
  • 51
  • 80