0

Recently moved from svn to git, pardon my newbie question.

In our release process, we code against the master (and development branches), we have releases once every few weeks, at that point in time, we create a branch and release against that branch.

Bug fixes go on to the branch and we update the release server with those fixes.

Now, when I try to do this in git and try to commit changes to the release branch, it doesn't let me commit and push changes to branch unless my master is in sync with origin/master. This gets messy if there are many release branches, now I have to make sure each one of them is in sync before I can fix a bug in a release and check it in.

How do you solve this problem?

aynber
  • 22,380
  • 8
  • 50
  • 63
Anand S
  • 87
  • 1
  • 10

3 Answers3

2

My team is currently performing releases exactly as you had describe in SVN. Code against trunk, branch and release.

With Git, the workflow changed - master matches production and is never touched, creating and removing branches is painless and 'cheap-as-chips' in Git, so every change/hotfix/development is always against a branch. This also enables you to track each development separately.

Once development is completed and tested, merge against master, tag and release. For a hot fix, branch master, test, release and merge to master.

For people developing on other branches, the branches can then easily be brought back up to date using merge.

Have a look at how github develop using git, a very interesting read that should answer your question - https://github.com/usm-data-analysis/usm-data-analysis.github.com/wiki/Developing-with-git

First Zero
  • 21,586
  • 6
  • 46
  • 45
0

Are you just doing "git push"? You can push a single branch (rather than all with matching names) using "git push origin somebranch".

araqnid
  • 127,052
  • 24
  • 157
  • 134
  • Yes, I am just doing "git push". I will try what you suggest. Thanks. – Anand S Jan 09 '12 at 13:29
  • Thanks, this thread was of great help as well. http://stackoverflow.com/questions/948354/git-push-current-branch. I did a "git config --global push.default current" that pushes only the current checked out branch. – Anand S Jan 09 '12 at 13:52
0

You are using a plain git push. By default git push will try to push every branch. You can set your configuration to use push.default=tracking.

git config push.default tracking

or

git config --global push.default tracking

With push.default=tracking, git push will only push the current branch.

Bill Door
  • 18,272
  • 3
  • 32
  • 37