Last active
August 23, 2021 21:33
-
-
Save olavmrk/9383860 to your computer and use it in GitHub Desktop.
git filter-branch command to remove all files except those of interest
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
# 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