-
-
Save VojtechVitek/e4f218865c0e7181f9cf264e1a1f3ebe to your computer and use it in GitHub Desktop.
git filter-branch command to remove all files except those of interest
This file contains hidden or 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
# Remove every file except "./somefile.txt" and the directory "./somedir". | |
# --prune-empty to remove empty commits. | |
git filter-branch --tree-filter "find . -not -path './.git' -not -path './.git/*' -not -path './somefile.txt' -not -path './somedir/*' -not -path './somedir' -delete" --prune-empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment