Skip to content

Instantly share code, notes, and snippets.

@rordi
Last active January 9, 2024 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rordi/28c5c7bdb2bfd89cd4287f60772e915d to your computer and use it in GitHub Desktop.
Save rordi/28c5c7bdb2bfd89cd4287f60772e915d to your computer and use it in GitHub Desktop.

Remove a large file from previous git commit / GitHub

E.g. when accidentally committing a large file to a git repo and GitHub refises the commit.

git filter-branch --tree-filter 'rm -f path/to/large/file' HEAD

Afterwards, simply try to push to GitHub again...

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