Skip to content

Instantly share code, notes, and snippets.

@borkweb
Created May 24, 2013 13:50
Show Gist options
  • Save borkweb/5643656 to your computer and use it in GitHub Desktop.
Save borkweb/5643656 to your computer and use it in GitHub Desktop.
Migrate a directory (with history) to a separate repo.
# First create the blank repository, then... git clone https://github.com/borkweb/whatever.git tmp-repo git clone --no-hardlinks tmp-repo new-repo cd new-repo git filter-branch --subdirectory-filter directory-to-migrate HEAD -- --all git reset --hard git gc --aggressive git prune git remote rm origin git remote add origin https://github.com/borkweb/new-repo.git git push origin master --force
@Rican7
Copy link

Rican7 commented May 24, 2013

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