Reputation: 31
I've been updating a facebook app through the basic workflow using heroku & git. I'm the only one working on it and the only thing that happens is a new binary once a week. git commit -am "new update" git push heroku
The binary has grown to about 30 MB. And lately all the push commands fail like this: Counting objects: 7, done. Compressing objects: 100% (4/4), done. fatal: sha1 file '' write error: Invalid argument error: failed to push some refs to 'mysecretgitplace'
I've looked in a lot of places and found out this is a very common issue that seems to be caused by nothing in particular and could be anything. Now as the only thing that changed over time is the size of the binary increasing and the number of commits increasing it's probably just that.
So now I'd like to try decreasing the server space I'm using by removing/destroying/obliterating the history of this one binary file (completely except for the current version (on the server at head/master whatever). I'd do this every once in a while in addition to weekly submitting the binary.
Is there a command that lets me do that? (without re-adding the whole "deleted" history of the file once I submit a new binary)
(It's probably obvious I just want to work on my game and not bother with all the server, version control stuff.)
Upvotes: 3
Views: 695
Reputation: 4196
Git allow you to remove part of your history by filtering it.
In your case, the first example should do the trick: git filter-branch --index-filter 'git rm --cached --ignore-unmatch filename' HEAD
.
Nevertheless, you should read very carefully about this command and what needs to be done on your repository and your remote for this to be effective (notably, you have to use git gc
in your local repository).
You can read more on this in the github help section.
As a side note, git is not really good with managing big files (look into git annex
for a potential solution).
Upvotes: 1