Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git list files on a commit and delete files and all history
# diff changed files against previous commit - this doesn't show anything for a first commit
git diff-tree --no-commit-id --name-only -r commithash
# list all files on a commit
git ls-tree --name-only -r commithash
# delete a file from all commit history
git filter-branch --tree-filter "rm -f filename" HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment