- Identify the commits that you want to merge with the target. What you are looking for is the commit hashes. You can find them in TFS, or you can use
If you know that every commit you’re looking for has the string$ git log --oneline188380:User Storyin it, then you can refine your search with something like the following:
In this example you might get a result like$ git log --oneline | grep "188380:User Story"
You are looking for the commit hashes:e2f13ae5 188380:User Story: Push Notification with blocked browser settings b3b65110 188380:User Story: Push Notification with blocked browser settings 5a1288bc 188380:User Story: Push Notification with blocked browser settingse2f13ae5 b3b65110 5a1288bc - Create a new branch based off your target branch.
$ git checkout -b Trav-Cherry-Pick origin/Master - Cherry pick your commits from the bottom of the list upwards:
$ git cherry-pick 5a1288bc $ git cherry-pick b3b65110 $ git cherry-pick e2f13ae5 - If you get any merge conflicts during the cherry-picking then fix them as they occur.
- Push your changes to a new remote branch.
$ git push -u origin Trav-Cherry-Pick - Finally, use GitHub or GitLab to create a pull request to merge your new remote cherry-pick branch with your remote target branch.
Categories: Development, Git
Leave a comment