Skip to content

Instantly share code, notes, and snippets.

@ifdattic
Last active January 1, 2016 17:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ifdattic/8174883 to your computer and use it in GitHub Desktop.
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.
# 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