git hack

Failed large file push / Can’t push to GitHub because of the previous failed large file push

Once I had tried to push a large file to remote and it failed. I realised later that github only allows for 100 mb file to push (at least through normal ways). It didn’t fix the issue even after deleting the large files from local repository, since the file is still there in the git history. It need to be deleted from history, which can be achieved by the following commands:

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <file/dir>' HEAD