I added over 9000 photos by accident to my project folder. And committed them. Then deleted them from disk. Committed.
Now I try to push changes to git server. But it takes too long and tries to send 12 Gb of data.
I checked files size on disk and see that really .git
folder takes 12 Gb.
How to delete photos from there? I tried git rm
, but fails:
? git rm public/photos
fatal: pathspec 'public/photos' did not match any files
Because I allready deleted them from disk, but they are still in .git
folder.
I tried to add public/photos
to .gitignore
:
public/photos/
*.zip
But no result.
Of course I could hard reset head
to moment when I did not have so many junk photos in my project. But since that time i committed many times and made a lot changes in code.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…