Possible Duplicate:
How can I remove a commit on github?
So a team member on our project has committed and pushed 700+ megs of nonsense to our git project repository... She thought she was adding only 2 images but instead somehow ended up copying the entire contents of her desktop to the git folder and somehow committing it. I don't know why she thought it wasn't weird that 2 pictures took 20 minutes to upload...
Anyways I'm in a predicament now as head of this project. I have 2 choices as far as I see it and I don't like either one
I could delete the repository from bitbucket and start it again with the files I want. This would remove all previous edits since only the current version of the files I want will be available
I could delete the erroneous data and push the changes. Only the files we want will be further managed but all the extra crud she put up there will forever exist in the git inflating our project 100 fold.
Is there any way to ACTUALLY remove a commit forever as if it never happened? What would be the best way to manage this hiccup other than more remedial git training...
I would do
$ git checkout master~1 -b newmaster
$ git branch -D master
$ git reflog expire --expire=now --all
$ git gc --prune=now
$ git checkout -b master
$ git branch -D newmaster
gc should do garbage collection. I think you can do this on the server.
I don't know if bitbucket allows it, but you can do:
git reset HEAD~
# Or the SHA of the version before the huge commit
git push --force
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With