Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Push changes to .git directory

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?

like image 891
Austin Avatar asked Nov 19 '25 02:11

Austin


1 Answers

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.

like image 190
davidlowryduda Avatar answered Nov 21 '25 18:11

davidlowryduda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!