1

I have an interesting problem, I can't seem to find a simple enough answer for this. I have 3 tracked branches: master, staging, production. Master is the main code that I play with and merge changes to. Staging is identical to my heroku staging server setup and production is the same case as staging.

After some reading around the internet (misplaced my bookmark to the beanstalk article), a nice way to work on changes is to branch from master, do a whole bunch of changes while committing regularly. Then this feature branch is merged into master, which gets tested on my dev machine.

Then the tricky bit, the feature-branch should be merged to staging branch which then gets pushed to heroku. If staging tests succeeds, I want to merge feature-branch to production as well.

Simple enough. The tricky part is really the fact that I have slight different setups on each branch. Master has some SSL stuff turned off etc. Staging has a few different certificates etc. Production has some newrelic tracking etc.

Doing a git merge seems to override my settings all the time. This is such a pain. I have been cherry-picking or git checkout <file list> to merge inidividual changes. Is there a way to go: "Merge all the commits (change-set) from the feature-branch into Staging branch", without bringing all the other stuff along?

dineth
  • 9,822
  • 6
  • 32
  • 39

1 Answers1

1

If you go the cherry-pick route, you can use the git-extract-patches, if you have good commit message (ie a commit message you can parse in order to select the commit for export).

Note that cherry-picking has some drawbacks (duplication and functional dependencies), but if you don't merge back Staging to feature-branch, it is ok.

Note also that, for single files that varry between branches, a content filter driver can also be another solution (avoiding any merge issue).
See as an example "Different versions of the same configuration file in different branches".

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • I may modify this script to try and make a patch file out of all the commits in a single branch since it was branched. This is a good place to start. Waited a couple of days to see any more answers will come through. At least for now, I can put the branch name into the commit message at the front with this. Cheers! – dineth Nov 30 '12 at 20:22