Domanda

Imagine a git repository that is structured as follows:

  • Main branch - development for the next major release is done here
  • Release branches - development on patches for releases is done here
  • Hotfix branches - hotfix branches are branched off from release branches to fix release bugs for patches.
Main    -------------------------------->
                  \
Release            o--------o
                       \   /
Hotfix                  o--

So hotfixes are developed off the Release branch, and in order to bring hotfixes into my Main branch, my previous pattern has been to use cherry pick merges. Now I'm questioning whether this is appropriate.

Would using regular merge to merge the Hotfix branch into the Main branch be more appropriate here? Are there any "gotchas" in either scenario?

È stato utile?

Soluzione

I'd rebase my hotfixes onto the release branch and once in a while merge in the release branch into main, so main get the fixes as well.

Cherry picked commits should be avoided imo, since they produce extra commits with the same content as the commit you are cherry picking from. Cherry pick is very useful if you have e.g. accidentally commited a hotfix on main but want the fix on the release branch as well but you don't want to do a full merge from main into release, since it might contain other stuff that you don't want to release yet.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top