Skip to content

Instantly share code, notes, and snippets.

@ksloan
Last active March 17, 2020 15:08
Show Gist options
  • Save ksloan/0b0ff3e83acafb09cc8f1c6010badb9c to your computer and use it in GitHub Desktop.
Save ksloan/0b0ff3e83acafb09cc8f1c6010badb9c to your computer and use it in GitHub Desktop.
Remove an entire directory from git history
git filter-branch --tree-filter "rm -rf FOLDER_NAME" --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
git gc
git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment