Skip to content

Instantly share code, notes, and snippets.

@harobed
Created December 3, 2017 12:49
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 harobed/abea7ac6fcbf07f16e417cafad3540e0 to your computer and use it in GitHub Desktop.
Save harobed/abea7ac6fcbf07f16e417cafad3540e0 to your computer and use it in GitHub Desktop.
Merge git `project/repos-b` in `project/repos-a` in `repos-b` subdirectory:

Merge project/repos-b in project/repos-a in repos-b subdirectory:

$ git clone git@example.com:project/repos-a.git
$ cd repos-a
$ git remote add -f repos-a git@example.com:project/repos-b.git
$ git merge -s ours --allow-unrelated-histories --no-commit repos-b/master
$ git read-tree --prefix=repos-b/ -u repos-b/master
$ git commit -m "Merge repos-b as our subdirectory"
$ git pull --allow-unrelated-histories -s subtree repos-b master
$ git push origin master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment