MacHg icon

Editing the History of a Repository

You can, if necessary, edit the history of a repository. In practice, many people want to be able to edit the history of a repository, and MacHg provides nice visual tools for doing such modifications. Editing the history means switching around the order of certain commits, collapsing a sequence of commits into a single commit, editing a commit message, moving commits from one branch to another, removing commits, etc.

Important:In general, you should be at least a semi-experienced user of Mercurial and MacHg before editing a repository history. It is recommended that you clone your repository before performing history altering operations, while you are learning about these editing operations. Also, be aware that if you have previously pushed a repository to a centrally accessible server before altering its history, you must then somehow arrange to have the histories of all other instances of the repository which have been pulled by others, correspondingly altered.

To edit the history of a repository:

  1. If you have not already done so, choose MacHg > Preferences..., go to the Mercurial tab in the preferences, and change the option History Editing from Disallowed to Allowed.

  2. Choose the repository to alter in the sidebar.

  3. If not already in the History view, switch to it (by selecting History View from the Document View menu).

  4. From the Repository menu choose the appropriate history editing command:

    • Edit Changesets... to run the Mercurial command 'histedit'. This will provide a semi-interactive way to edit a consecutive range of changesets.

    • Collapse Changesets... to run the Mercurial command 'collapse'. This will take a consecutive range of changesets and collapse them into a single changeset.

    • Strip Changesets... to run the Mercurial command 'strip'. This will strip (delete) all child changesets from the selected revision downwards.

    • Rebase Changesets... to run the Mercurial command 'rebase'. This will move a revision and all its children from one branch to another.

Many of the history editing commands apply to a selected revision and all children derived from that revision, ie., the sub-tree of revisions rooted at the selected revision.

External Links

Editing Repository History