Skip to content

Instantly share code, notes, and snippets.

@lucsh
Created September 8, 2021 13:25
Show Gist options
  • Save lucsh/a1ded8cbf3425676add71b352c0afeb4 to your computer and use it in GitHub Desktop.
Save lucsh/a1ded8cbf3425676add71b352c0afeb4 to your computer and use it in GitHub Desktop.

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