Reputation: 3364
I'm getting familiar with git and recently made a mistake: from one computer I added lots of big files (100Mb each, 70GB whole), committed them and pushed to the master. Now, I want to pull on another computer (with a smaller hard drive), and I'm stuck.
I cannot completely pull from the remote repository (due to no space on hard drive) but I also cannot free the local git repository of the bloat.
My question is: how can I revert my repository to the state where it does not need that big amount of local hard disk space? (I will delete the files with next push from another computer).
Upvotes: 4
Views: 1767
Reputation: 24251
You need to do
git reset
or
git filter-branch
with correct parameters. To rewrite your history.
and then you've to push this with --force to your remote repository. Note that this will make things a bit harder for everyone that uses that repository since they will have to do a rebase or a fresh clone.
git push --force
To remove the commit from your branch. Now the commit will still be present for another 14 days or so on your remote and on the computer that contained that commit. Either you don't care or you run
git gc --prune=now
Upvotes: 1