Skip to content

Instantly share code, notes, and snippets.

@lucsh
Created September 8, 2021 13:25

Remove the file called Rakefile:

git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch Rakefile' \
  --prune-empty --tag-name-filter cat -- --all

git push --all --force

This command will run the entire history of every branch and tag, changing any commit that involved the file Rakefile, and any commits afterwards. Commits that are empty afterwards (because they only changed the Rakefile) are removed entirely.

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