Created
October 17, 2014 02:44
-
-
Save MrSaints/269adaa4e2a46259bf31 to your computer and use it in GitHub Desktop.
Transfers a Git file from one repository to another while maintaining its Git history.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git filter-branch --prune-empty --subdirectory-filter <DIRECTORY TO FILTER> -- --all | |
git filter-branch -f --prune-empty --index-filter 'git rm --cached --ignore-unmatch $(git ls-files | grep -v "<FILE TO FILTER>")' | |
git reset --hard | |
git remote rm origin | |
git gc --aggressive | |
git prune |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment