0

Good day,

Here's the situation:

  • I have a master branch which is similar to production.
  • I have a develop branch which contains all tested work and ready to be deployed in the next release.
  • I develop new features on feature branches, based on the develop branch.
  • Sometimes I have to hotfix the master branch, therefore I create hotfix branches.

When I work on feature branches, if it takes too long or if important updates have been pushed to the develop branch, we merge the develop branch into our feature branch in order to fix possible conflicts on the feature branch.

When I have to hotfix the master branch, I create a child branch from it and work on this hotfix branch, before merging it back to the master and develop branches.

The problem is that sometimes, I have to suddenly deploy a feature branch without deploying what's on the develop branch (even though it has been tested and approved, it might not be the right time to deploy it).

To do so, I can think of only one safe way: create a hotfix branch from master, cherry-pick commits from the feature branch and merge the hotfix branch back into master and develop.

I can't just merge the feature branch into the hotfix branch, as it might contain commits from develop (through the creation of the feature branch from develop, or through the merges of develop into the feature branch (to keep it up to date)).

I'm pretty sure there are nicer ways to proceed, but I can't get a hold of the way to do so. Maybe git rebase with interactive mode? but I can't make if work properly.

To summarize: how to hotfix a master branch with an existing feature branch that may contain unwanted commits.

Any ideas are welcome.

Regards.

gael
  • 55
  • 1
  • 1
  • 8
  • 2
    How do you define "nicer"? There is nothing wrong with your cherry-picking approach. –  Jan 25 '16 at 14:09
  • 1
    Possible duplicate of [How to merge a specific commit in git](http://stackoverflow.com/questions/881092/how-to-merge-a-specific-commit-in-git) – Vamsi Ravi Jan 25 '16 at 23:42
  • @torazaburo: if there's a large number of commits to cherry-pick, it's not very convenient I think – gael Jan 26 '16 at 09:20

0 Answers0