Even if you perform a git rm
, the files will continue in the project history. That way, you will have to download them when you clone the repository. To remove the files forever, you need to change the history.
If the commit that added the files are very recent, you can perform a git reset
to a commit before the commit that added the files. But, if the files were added some time ago, you need to use git filter branch
. I will show some steps that I use when I want to delete big files from the repository.
git filter-branch --index-filter 'git rm --cached --ignore-unmatch file-or-directory-that-you-want-to-remove-with-complete-path' --all.
Then, you need to perform a git push -f
because you changed the project history. This way, when you clone the project again, the files that were removed will not be downloaded anymore.