My .git
dir got large because I accidentally added (then removed) a few large files.
I found this git-delete script that seemed to shrink the size of the .git
dir nicely. However, I'm not able to add/commit/push changes to this directory. I get the "not up to date, please pull" error.
Anyone know how I can apply these changes to my repo?
You can append --force
or -f
to git commands to force git to accept commits that rewrite history. Note that rewriting history is not a good idea for public projects. But for my own git repos that aren't public facing, I rewrite history from time to time.
After you have made your commits, you can do git push REPO BRANCH --force
to force the change. In practice, this is often git push origin master --force
.