Customer Needs
My team already had a go-live app in a customer environment some months ago. We have been developing some new features for our next milestone. The situation is described in the picture below:Our customers wanted to have two separated release packages for our current sprint release. We all know that it was easy to ship the package to the developing app. However, the issue was that how we just picked some features needed for the go-live app. We called this package was a hotfix.
Git Cherry-Picking
Fortunately, we found that Git provided a way to achieve this task. Actually, we had all commits on the branch `master` already. We created a new branch called `hotfix/v1.1` and we traced back which commits needed. We used cherry-picking for merging these commits to this branch.For example, let's use git log to watch the commits. From `v2` to `v3`, we have the following commits:
commit abcde1
commit abcde2
commit abcde3
commit abcde4
....
From `v6` to `v7`, we have the following commits:
commit xyzwq1
commit xyzwq2
commit xyzwq3
commit xyzwq4
....
Then, let's use git cherry-pick to choose our desired commits (for sure, sometimes solving conflict is required). For example:
git cherry-pick abcde2
git cherry-pick abcde3
git cherry-pick xyzwq2
git cherry-pick xyzwq3
git cherry-pick xyzwq4
That's it. Happy coding!
Reference
[1]. https://git-scm.com/docs/git-cherry-pick