Skip to content

Instantly share code, notes, and snippets.

@cuibonobo
Created September 25, 2016 00:25
Show Gist options
  • Save cuibonobo/7573208857572550ffa5c70808ab1fa1 to your computer and use it in GitHub Desktop.
Save cuibonobo/7573208857572550ffa5c70808ab1fa1 to your computer and use it in GitHub Desktop.
Splitting a repo (on git versions 1.7.11+, this is done with git subtree)
#/bin/bash
git clone unicorn unicorn-calendar
cd unicorn-calendar
git filter-branch --prune-empty --subdirectory-filter apps/calendar master
git reset --hard
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git reflog expire --expire=now --all
git gc --aggressive --prune=now
git remote rm origin
# Add a new origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment