tags:

views:

260

answers:

1

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.

+4  A: 

Thanks Don, I'd seen that but somehow hadn't realised it fixed my problem, because I only have one branch.

I did:

git push -f origin 5910117a8fc2c71334251465b54d6d9daeb28d1c:master

And it's all back to how it was.

Stray
that works fine. you might like to take a moment to think about whether letting anyone with access to the repo being able to do that is good or not :) going to the remote repo directly and using git reset to move its master branch is another alternative that can usually bypass any permissions checks implemented in hooks.
araqnid
You might want to add:git reset --hard 5910117a8fc2c71334251465b54d6d9daeb28d1cThat will make sure your local copy is also reverted back to that specific revision (otherwise, it will seem like your local repo differs from the remote).
Chris R