Skip to content

Instantly share code, notes, and snippets.

@chadly
Last active March 11, 2019 21:55
Show Gist options
  • Save chadly/9e1c3a7fd0f86bb20794fe0f962b8a24 to your computer and use it in GitHub Desktop.
Save chadly/9e1c3a7fd0f86bb20794fe0f962b8a24 to your computer and use it in GitHub Desktop.
Graft two repos together and then bake the graft in
# in first monorepo
git remote remove origin
git tag -l | xargs git tag -d
git filter-branch --prune-empty --subdirectory-filter FOLDER-NAME master
git update-ref -d refs/original/refs/heads/master
# in second repo (the one that was originally added to the monorepo)
git remote add cs ../civicsource
git fetch cs
# first rev is later commit, second rev is commit to bolt first commit onto
echo bf8bd922b517f63d95a247129259dfe66c7b938c b1fe9e621d1b69cecef1bc516fb22553ef7e8508 >> .git/info/grafts
# merge the branches and delete remote
git merge cs/master
git remote remove cs
# bake the graft in
git filter-branch -- --all
rm .git/info/grafts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment