Possible Duplicate:
How to purge a huge file from commits history in Git?
I did a stupid thing. Imagine that I committed a 100MB file. Then I see this and delete this file and commit again. This is a normal procedure to delete a file.
But now the side effect is that my history is heavy because it's saved this large file (I believe this is why it is heavy). I am only using local git, so I do not synchronize in any server.
How can I definitively remove this file and save disk space?
If this is your last commit and you want to completely delete the file from your local and the remote repository, you can: remove the file git rm <file> commit with amend flag: git commit --amend.
You can do it using the git filter-branch
command, like this :
git filter-branch --index-filter "git rm -rf --cached --ignore-unmatch path_to_file" HEAD
You can find more documentation here http://dalibornasevic.com/posts/2-permanently-remove-files-and-folders-from-a-git-repository
The command you are looking for is filter-branch
. It allows you to permanently remove files from an enlistment. This blog has a great tutorial on how to remove problematic files from the repository
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With