Say I have two branches in Git: development
and qa-test
. Both of these branches contain different features - commits but also A
is the latest common ancestor of these two branches:
A--->B--->C--->developent
\
\
D--->E--->qa-test
Now in some point we have found out that there was a bug in A
, and we need to have fixed them both in qa-test
and in development
, i.e. we need to hotfix. One of the ways I can go is to create a new branch from qa-test
names hotfix
, fix there the bug, commit in into qa-test
and then cherry-pick this into development
. Is there a better way of doing this?
Create a branch from A and then merge the changes of the with qa-test
and development
.
$ git merge-base qa-test development
sha-1 A
$ git checkout -b hotfix <<sha-1 A>>
... do changes and commits
$ git checkout devel
$ git merge hotfix
$ git checkout qa-test
$ git merge hotfix
$ git branch -d hotfix