Can I undo the last git push?

Posted by Stray on Stack Overflow See other posts from Stack Overflow or by Stray
Published on 2010-06-10T08:53:24Z Indexed on 2010/06/10 9:12 UTC
Read the original article Hit count: 256

Filed under:

A team member accidentally pushed half a gig of unwanted zips to the remote repo last night when they were in a rush. Yes... oops.

Nobody has pulled or committed since.

Ideally I want to just 'undo' what happened.

I have looked at filter-branch and was thinking of trying something like

git filter-branch --tree-filter 'rm -f *.zip' HEAD

but that would be local, and I can't figure out how to do it direct on the remote repo.

Is there a simpler way to undo what happened? If she amends her last commit and pushes again will that undo the push - ie actually remove those files from the history?

Obviously if she deletes them, commits and pushes again then that still leaves the content in the repo, which is no good.

© Stack Overflow or respective owner

Related posts about git