Reputation: 267170
I added a 50mb file or so and did a git commit
.
I starting doing a :
git push origin master
But mid-way I cancelled the operation.
I don't want to wipe the entire commit as there are other files I want commited (and not lost).
Upvotes: 5
Views: 410
Reputation: 129654
Good that you cancelled it.
Remove the giant file.
git add -A
git commit --amend -C head
git push origin yourbranch
You should be fine.
Upvotes: 2
Reputation: 31461
Step one DO NOT PUSH If you have pushed, report back after doing something drastic.
Decision: Has this been the last commit you made?
Step two--lastcommit: git commit --amend
Step two--oldercommit: read and follow the man git-rebase
page for the bit about splitting commits
Step three: read and follow the man git-filter-branch
page for the bit about how to compress your .git directory. Not critical and it will happen automatically eventually.
Step four: Make a clone from you current repo to double-check that the large file is not sticking around. Verify by repo size and the absence of the file.
Step five: Push
Upvotes: 0
Reputation: 11832
There's another very similar question here that describes a number of options:
Completely remove file from all Git repository commit history
The simplest solution would git's filter-branch
command.
Upvotes: -1