If I have a public Git repository that contains 3 branches like the following:
(release-to-customerA)
|
U (master)
/ |
A---B---C---D---E ... S---T
|
(release-to-customerB)
where commit ‘B’ was the original release version and commit ‘U’ resolved some bugs in ‘B’. I want to apply the commit ‘U’ to both master and release-to-customerB branch, and when the next time I deliver a new release to the customers based on the commit ‘D’, ‘E’, … ‘T’, I want the commit ‘U’ included. What is the cleanest way to do it?
I know that git rebase or git cherry-pick may do the trick in my local repository, but will I screw up the history when I submit the rebased work to the public repository?
Thanks for the answers.
Though cherry-picking will work, I’m not sure why you’d want to. It creates duplicate commits, which can cause problems if you ever want to merge. Indeed, this appears to be a case where you want to merge!
Note that I added a branch name bugfixB – this is a very general idea. The commit
Ushould be made on a branch whose purpose is to fix B (it could be several commits). That branch should then be merged into all branches which need the bugfix – in this case, releaseA, releaseB, and master.