Last active
January 1, 2016 17:09
-
-
Save ifdattic/8174883 to your computer and use it in GitHub Desktop.
An example of using cherry-pick to move commits between different repositories (refactoring project case). Also contains full workflow of fetching, merging and cleaning up.
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
# The gist for cherry pick between repositories | |
git remote add repositoryName An:\\absolute\path\to\repo | |
git fetch --progress --prune repositoryName | |
# OR | |
git remote show repositoryName | |
git fetch --progress -n repositoryName refs/heads/branch-name:refs/remotes/repositoryName/branch-name | |
git checkout -b local-branch-name | |
git cherry-pick COMMITID # repeat as much as needed | |
git checkout master | |
git merge --no-ff local-branch-name | |
git branch -d local-branch-name | |
git remote rm repositoryName |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment