tags:

views:

184

answers:

2

So I keep making a silly mistake in Mercurial. Often times, I'll start work without doing an "hg pull" and an "hg update." When I try to push my changes, I get an error.

Is there any way to delete my local commits so I can avoid creating multiple heads, branches, ect? I just want to delete my local commits, merge my changes with the tip, and then re-commit. Sounds simple, right? I can't seem to find any way to easily delete local commits so I can cleanly merge with the tip.

Again, I'm only trying to delete local commits made with "hg ci". I don't want to modify files, revert, ect.

+2  A: 

You can get around this even more easily with the Rebase extension, just use hg pull --rebase and your commits are automatically re-comitted to the pulled revision, avoiding the branching issue.

too much php
A: 

As everyone else is pointing out you should probably just pull and then merge the heads, but if you really want to get rid of your commits without any of the EditingHistory tools then you can just hg clone -r your repo to get all but those changes.

Ry4an
Does "hg clone -r" delete local changes? I just want to delete local commits to keep things simple.
It doesn't delete them from the cloned repository, but it creates a new clone that doesn't have them. Then you can delete the repo you modified if you'd like.
Ry4an