Skip to content

Instantly share code, notes, and snippets.

@patrickwolf
Created September 9, 2022 12:25
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 patrickwolf/cc7461e2e2de4722c5351feb0d41b5d4 to your computer and use it in GitHub Desktop.
Save patrickwolf/cc7461e2e2de4722c5351feb0d41b5d4 to your computer and use it in GitHub Desktop.
How to merge Git repos with common code BUT NO common ancestry
git init
git remote add new https://github.com/patrickwolf/sandbox_repoNew
git remote add old https://github.com/patrickwolf/sandbox_repoRoot
git fetch new
git fetch old
echo "first" > readme.md
git add readme.md
git commit -m "first"
git branch combined
git rebase --rebase-merges --onto 9086ffd 80ece84 combined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment