Reputation: 8173
I accidentally staged a 3GB file. The git reset
undo the stage. However, the .git folder became several GB larger than before. How can I fully undo the stage and shrink the .git to normal size?
Upvotes: 0
Views: 29
Reputation: 488183
Unless you need the space back right away, just let Git be Git, and the space will come back in roughly two weeks.
If you do need the space back right away, you can force Git to prune unreferenced loose objects immediately:
git prune --expire now
Be careful with this as it does not coordinate with other Git commands that may be running at the same time, creating loose objects, expecting them to stick around for 14 days while they get their own job done. (In other words, make sure you are not running any other Git commands, if you run this one.)
Upvotes: 1