Skip to content

Instantly share code, notes, and snippets.

View rroyGit's full-sized avatar
🎯
Grinding LC

Rupam Roy rroyGit

🎯
Grinding LC
View GitHub Profile
@rroyGit
rroyGit / removeexcept.sh
Created December 21, 2018 18:45 — forked from olavmrk/removeexcept.sh
git filter-branch command to remove all files except those of interest
# 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