Jeanpierre Rivas
Jeanpierre Rivas

Reputation: 282

How to remove a Mercurial commit that has been pushed?

I have a system that is in a bitbucket repository, I uploaded it with Mercurial.

I had a problem a few days ago of uploading a document that I should not have touched. Now I want to know if there is a command option to remove the commit I made.

Of course I tried with hg log -l 5 and then hg strip 'id commit', but I do not want to go back to a previous point, if not delete the commit. To be more precise, the last one.

Note for expert! only: Remember I have already pushed my commit to bitbucket

Upvotes: 2

Views: 163

Answers (1)

peak
peak

Reputation: 116640

The only way to "remove the commit" is by stripping it on bitbucket, but that has several disadvantages, especially if someone besides you has already "pulled" the offending commit.

The preferred way to handle your situation is to use hg backout. This "hides" the commit, rather than actually removing it.

Upvotes: 2

Related Questions