Let’s say you have two public feature branches, feature1 and feature2.
The workflow in question that public feature branches are considered “integration” branches.
Each of these two branches are being worked on by two different developers, minding their own business.
One day, the developer of feature1 realizes that he needs some of the code in feature2. What is the best way of going about this.
Let’s assume the code in question can be cherry-picked because each commit was focused enough so that they only refer exactly to the code in question.
My gut feeling, however, is that cherry picking the commits will lead to problems later down the line, since they have different SHA1s. It will also (I think), lose the original author info.
Is there a better way of going about this?
First,
git cherry-pickdoesn’t lose information about the original author, that stays the same. It does lose information about the commiter, but that’s correct.Now, git is pretty clever when it comes to merging, so I think you should have no problems when you cherry-pick the commits you want. But if you want to make sure, you can always try it out on a temporary branch (or in a temporary copy of the repo).