Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to wind back a commit using "hg revert"?

I did a commit that I had to revert on my server because it wasn't working. I did "hg revert --all --rev 855" and stripped my changes from my Bitbucket and my local. When I did "hg update" and tried to pull the next changes I made I got "abort: crosses branches (use 'hg merge' to merge or use 'hg update -C' to discard changes)"

How can I go forward with just the wanted changes and lose the commits/heads?

like image 583
James Avatar asked Jan 23 '26 14:01

James


1 Answers

You want to do a backout not a revert. First, clean up your working directory by removing any uncommitted files:

hg revert -a

Then remove the problematic commit using backout:

hg backout -r 855

You will be prompted for a commit message. Save it and you're good to go.

like image 123
Stephen Rasku Avatar answered Jan 26 '26 14:01

Stephen Rasku