Skip to content

Instantly share code, notes, and snippets.

@sandfox
Created August 9, 2012 15:33
Show Gist options
  • Save sandfox/3305180 to your computer and use it in GitHub Desktop.
Save sandfox/3305180 to your computer and use it in GitHub Desktop.

Create the 'master' repo

mkdir big-repo
cd big-repo
git init

Add the first 'child' repo

git remote add -f frontend git://github.com/someplace/frontend.git
git merge -s ours --no-commit frontend/master

git read-tree --prefix=frontend/ -u frontend/master

git commit -m "Subtree merged in frontend"

Now add the second 'child' repo

git remote add -f api git://github.com/someplace/api.git
git merge -s ours --no-commit api/master

git read-tree --prefix=api/ -u api/master

git commit -m "Subtree merged in api"

The master repo should end up looking like this

.
..
/frontend
/api
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment