Can I undo the last git push? Can I undo the last git push? git git

Can I undo the last git push?


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.


I think

git reset --hard HEAD^git push -f

should to the trick: It resets your local checkout to the previous commit (assuming the last one is the one you want to drop) and force pushes it to the remote repository.