At work, if I am working on a bug fix, I sometimes want to base my hotfix branch off of the merge-base
of our master
and develop
branches, because the branch will eventually be merged into both of these branches, and sometimes, they (master
and develop
) will have diverged. From the command line I would do this with:
git checkout `git merge-base master develop`
git checkout -b my-hotfix-branch
What I am wondering is, is there a straightforward way to do this in magit
?
I don't fully understand some of the options in the branching popup, even after reading the documentation, and I am hesitant to experiment with my work repository. I know how to do the second command (checkout a new branch once I have checked out the merge-base
, but I am not sure how to check out the merge-base
itself).
Worse comes to worse, I assume everything will go fine if I run the command from the magit-run-popup
, but I am curious if there is a better way. Thank you!
hotfix
branch into bothmaster
anddevelop
without having to merge one of these two branches into the other?master
or evendevelop
, but I was told that I should just do it this way to be on the safe side so that I don't need to worry about what statemaster
anddevelop
are in.hotfix
at some essentially random commit. Branching of the commit that introduced the bug might make more sense. But that might have been a long time.hotfix
has to be merged into both branches. If so, then branch of the merge-base (or possibly the commit which introduced the bug). Otherwise branch ofmaster
and then merge it back into that. If it later turn out that the fix is also needed indevelop
and you don't want to mergemaster
to get it, then you could always just cherry-pick the fix.