Skip to content

Instantly share code, notes, and snippets.

@digitalcoyote
Created August 27, 2018 21:24
Show Gist options
  • Save digitalcoyote/3fa8e348619a65031f4aacada1964a10 to your computer and use it in GitHub Desktop.
Save digitalcoyote/3fa8e348619a65031f4aacada1964a10 to your computer and use it in GitHub Desktop.
A one-liner for removing a file/folder from a git repo
git filter-branch --index-filter "git rm --cached -f -r --ignore-unmatch <file/folder name>" -f --prune-empty -d "<tempDirectory>" -- --all
@digitalcoyote
Copy link
Author

You have to use the file/folder names that existed at the time of the commit. If the name changed, it you will need to do both the new and old names

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