I’ve done it again, super excited to work on my new pet project, I ran dd command to test my new VPS I/O Speed and created a 1-gigabyte file in my repository folder, and somehow I accidentally committed that.

Unless you’re using a self-hosted git server with a large max upload, you’ll probably get an error trying to push your changes with this large file, since this file will be in git history for restoration purposes, simply removing it from the repository and doing another commit does not work.

To resolve this issue you can use git filter-branch as below:

git filter-branch --force --index-filter \
  'git rm --cached --ignore-unmatch path/to/bigfile.data' \
  --prune-empty --tag-name-filter cat -- --all

Replace the path with the location of the big file, you can then push your changes to your remote branch.

Leave a comment

Leave a Reply