Sophie Alpert
Sophie Alpert

Reputation: 143124

Amending a "public" changeset in Mercurial

I'd like to amend my last commit, but running

hg commit --amend

gives me

abort: cannot amend public changesets

even though I know that it's safe to edit the changeset. How can I change the phase of my last commit and/or tell Mercurial that it's safe to amend?

Upvotes: 17

Views: 9954

Answers (1)

Sophie Alpert
Sophie Alpert

Reputation: 143124

On the Mercurial wiki, there's a good overview of phases.

To convert the current commit from "public" to "draft" commit in order to allow amending, use

hg phase --draft --force .

(or replace . with another revision if you want to edit a different changeset).

Upvotes: 35

Related Questions