How can I undo my last accidentally commited (not pushed) change in Mercurial?
If possible, a way to do so with TortoiseHg would be prefered.
Update
In my concrete case I commited a changeset (not pushed). Then I pulled and updated from the server. With these new updates I decided, that my last commit is obsolete and I don't want to sync it. So it seems, that hg rollback is not exactly what I'm searching for, because it would rollback the pull instead of my commit.




hg rollback, and then pulling again? - VonCstrip --keep: stackoverflow.com/questions/29413851/… directly solves the task, as does MQ qimport. Alternatively, it may be better simply torebasein the scenario if the local changes are also to be kept and there is no conflict. (Use a merge to keep some combined changes from both branches when that is the desired graph end-goal, especially on a non-fastforward case.) It may also be valid just to close the branch, which still 'preserves history' (but differently than a merge) depending on the final state desired. - user2864740hg strip --keepis the command do use, but you need to provide a revision, e.g.:hg strip --keep -r .. This answer explains well stackoverflow.com/a/19064016/1286571 - ForeverWintr