Skip to content

Instantly share code, notes, and snippets.

@magnusdahlstrand
Created May 29, 2012 15:53
Show Gist options
  • Save magnusdahlstrand/2829187 to your computer and use it in GitHub Desktop.
Save magnusdahlstrand/2829187 to your computer and use it in GitHub Desktop.
Import git repo into another repo while keeping the history of both.
//From http://stackoverflow.com/a/8396318/657977
Switch [NAME] for whatever name you want to call it
Switch [PATH or URL] for the path or url to the repo you want to include.
git remote add [NAME]_remote [PATH or URL]
git fetch [NAME]_remote
git merge -s ours --no-commit [NAME]_remote/master
git read-tree --prefix=[NAME]/ -u [NAME]_remote/master
git commit -m "Imported [NAME] as a subtree."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment