Last active
December 20, 2019 21:01
-
-
Save nara-l/39d3ef0725337ed31075fcde4cac099b to your computer and use it in GitHub Desktop.
GIT: Cherry Picking commits from another branch to a new branch git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Picking specific commits from one git branch to a new one | |
#. 1. Create a new branch off master or any clean branch and checkout into the new branch | |
# 2. Use git log --pretty=oneline # on the branch with the needed commits to see the <sha> for the commits needed | |
# command | |
git cherry-pick 108e055..3f7cf07 # does not include commits from 108e055. 108e055 being the oldest commit and 3f7cf07 the lastest | |
git cherry-pick 108e055^..3f7cf07 # to include commits from 108e055 | |
# usually you need to do a git add . and git commit to add the new files and create new commit message for the moved files | |
#cherry picking the last commit | |
git cherry-pick [branch_to_cherry_pick_from] . # it could be master as well | |
# cherry-pick 1 commit | |
You are currently cherry-picking commit d856905 | |
# git show 28703c6f , to show history of sha |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment