# Evolve How To

Just use commit as usual. New changesets will be in the draft phase.

## Rewrite a changeset: amend

A dedicated command hg amend is added by the extension. It writes a new changeset combining working-directory parent changes and parent. It will work on any draft or secret changeset. It will not work on public changesets.

To understand what the result of amend will be I use the two following aliases [1]:

# diff what amend will look likes
pdiff=diff --rev .^

# status what amend will look likes
pstatus=status --rev .^


It takes various options to pick an author, a date and the branch of the result... (see hg help amend for details).

This command can even be invoked on changesets with children (provided none is public) !

Note

The amend command is very similar to mq's qrefresh, a refresh alias for amend is also available. But note that contrary to qrefresh, amend does not exclude changes on file not specified on the command line.

Warning

The hg commit --amend switch does not lay obsolete marker down yet. You should always prefer the dedicated command.

## Move a changeset: graft

The graft command introduced in 2.0 allows to "copy changes from other branches onto the current branch".

The graft command has been altered to allow the creation of an obsolete marker between both the result cset and its source (actually recording changeset movements).

This is achieved using a new flag -O (or old-obsolete) [2].

XXX Need a few examples here.

Warning

when using graft --continue after conflict resolution you MUST pass -O or -o flag again because they are not saved for now

 [2] add this -O to graft instead of a dedicated command is probably abusive. But this was very convenient for experimental purposes. This will likely change in non experimental release.

## Delete a changeset: kill

A new kill[#]_ command allows removing a changeset.

Just use hg kill <some-rev>.

 [3] kill is a terrible name. NEVER forget to add hg in front of it until we find a better name.

## Moving within the history: upgdown and gup

While working on mutable part of the history you often need to move between mutable commit.

You just need to use standard update to work with evolve. For convenience, you can use hg gup to move to children commit or hg gdown to move to working directory parent commit.

Note

those command only exist for the convenience of getting qpush and qpop feeling back.

## Collapse changesets: amend

You can use amend -c to collapse multiple changeset in a single one.

Note

This is a terrible UI. hg collapse should be ported to obsolete marker for this purpose.

## Split a changeset

There is no official command to split a changeset [3] . However is it easily achieved by manual operation:

### you want to split changeset A: 42
# update to A parent
$hg up 42^ # restore content from A$ hg revert -r 42 --all
# partially commit the first part
$hg record # commit the second part$ hg commit
# informs mercurial of what appened
# current changeset (.) and previous one (.^) replace A (42)