Skip to content

Instantly share code, notes, and snippets.

@duncanjbrown
Created February 22, 2018 22:44
Show Gist options
  • Save duncanjbrown/ecc3c67a5e4f551dc89e1fe272142864 to your computer and use it in GitHub Desktop.
Save duncanjbrown/ecc3c67a5e4f551dc89e1fe272142864 to your computer and use it in GitHub Desktop.
Move commits from one repo to another using git
# I was moving a vanilla WP site to Bedrock but wanted to start
# working in Bedrock sooner, so I needed to backport commits
# from Bedrock to the old repo. Bedrock uses a different folder structure, so
# whereas my commits were in in web/app/themes/mytheme, the old
# repo needed changes in wp-content/themes/mytheme.
# In Bedrock
cd web/app/themes/mytheme
git format-patch --relative <commit-hash-at-branch-base> --stdout > ~/patches-from-bedrock
# In root of old site
git am --directory wp-content/themes/cocoarunners-light ~/patches-from-bedrock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment