Skip to content

Instantly share code, notes, and snippets.

@varl
Created December 1, 2016 09:41
Show Gist options
  • Save varl/5b151967a270ca2f51f16a81f3772927 to your computer and use it in GitHub Desktop.
Save varl/5b151967a270ca2f51f16a81f3772927 to your computer and use it in GitHub Desktop.
Git: Split a directory into a new repository
old-repo$ git subtree split -P dir -b only-dir
new-repo$ git init
new-repo$ git pull /path/to/old-repo only-dir
new-repo$ git remote add origin <url>
new-repo$ git push origin -u master
old-repo$ git rm -rf dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment