> ## Documentation Index
> Fetch the complete documentation index at: https://docs.diversion.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Changing the past

> How to undo, cherry-pick, edit, or copy details from a previous commit

## Undoing a commit

Committed something and wish you hadn't? No worries, you can undo a previous commit with a `revert`. This will create changes that are the opposite of the commit you want to undo.

<Steps>
  <Step title="Go to your repo history">
    Open the workspace of the repo where your changes are. Make sure that you have no pending changes. In the left navigation rail, click **Commits**.
  </Step>

  <Step title="Select commit to revert">
    Click on the menu icon next to the commit you want to revert, and select "Undo this commit". In the modal window, click "Undo changes". It's possible you'll have to resolve a merge conflict, see below.

    <img src="https://mintcdn.com/diversion-2/byT8FECKa2zLvaOH/images/revert-undo-commit.png?fit=max&auto=format&n=byT8FECKa2zLvaOH&q=85&s=2aa60123406a6e60fceab79b9a06f14f" alt="Undo commit" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="976" height="604" data-path="images/revert-undo-commit.png" />
  </Step>

  <Step title="Admire your work">
    You'll see new changes in your workspace that undo the changes for your commit.

    In this example, this is the commit I chose to undo:

    <img src="https://mintcdn.com/diversion-2/tgHOXPild1lTdU_m/images/example-commit-reverted.png?fit=max&auto=format&n=tgHOXPild1lTdU_m&q=85&s=56ccd60b429413db16682e93fd9cff04" alt="Reverted commit" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="615" height="229" data-path="images/example-commit-reverted.png" />

    And this is the resulting change in my workspace:

    <img src="https://mintcdn.com/diversion-2/hNFKL35i0RPRSCiK/images/example-commit-reverted-outcome.png?fit=max&auto=format&n=hNFKL35i0RPRSCiK&q=85&s=f1dbfc42051208148c0cc9c11bb05e38" alt="Workspace after commit revert" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="730" height="290" data-path="images/example-commit-reverted-outcome.png" />
  </Step>

  <Step title="Resolve a merge conflict?">
    If you try to revert a commit that affects a file that was also affected by a later commit, it will result in a merge conflict. You'll have to resolve the conflict before you can commit the changes.

    Earlier, I reverted a file that was edited. Now, instead, I'll try to revert an earlier commit - the one where the file was created.

    <img src="https://mintcdn.com/diversion-2/tgHOXPild1lTdU_m/images/example-commit-reverted-with-merge.png?fit=max&auto=format&n=tgHOXPild1lTdU_m&q=85&s=e67cdb4f2429db60c88cac7349abdc9c" alt="Workspace after commit revert" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="586" height="488" data-path="images/example-commit-reverted-with-merge.png" />

    This will result in a merge conflict, which you'll have to resolve before you can commit the changes.

    <img src="https://mintcdn.com/diversion-2/tgHOXPild1lTdU_m/images/example-commit-reverted-with-merge-outcome.png?fit=max&auto=format&n=tgHOXPild1lTdU_m&q=85&s=579ec843f81ebc7463ad7444370c02b0" alt="Workspace after commit revert" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="1754" height="587" data-path="images/example-commit-reverted-with-merge-outcome.png" />
  </Step>
</Steps>

## Editing a commit message

Made a typo in your commit message, or want to add more detail? You can edit the message of any commit you authored directly from the Commits view.

<Note>
  Editing commit messages is only available for the commit author, and is not supported for repositories synced with Git.
</Note>

<Steps>
  <Step title="Open the commit menu">
    In the Commits view, click on the menu icon next to the commit whose message you want to change, and select "Edit commit message".

    <img src="https://mintcdn.com/diversion-2/byT8FECKa2zLvaOH/images/edit-commit-message-menu.png?fit=max&auto=format&n=byT8FECKa2zLvaOH&q=85&s=9e7b82d5937c06fdbd0b01b223714c2e" alt="Edit commit message menu option" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="976" height="604" data-path="images/edit-commit-message-menu.png" />
  </Step>

  <Step title="Update the message">
    An "Edit commit message" dialog will appear, showing the commit ID for reference and a text area with the current message. Edit the message as you like, then click "Update" to save it.

    <img src="https://mintcdn.com/diversion-2/TRW0X-dHr9C3-PTk/images/edit-commit-message-dialog.png?fit=max&auto=format&n=TRW0X-dHr9C3-PTk&q=85&s=bbe6bdcf50d0a813bf1b6b85dd76739a" alt="Edit commit message dialog" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="798" height="437" data-path="images/edit-commit-message-dialog.png" />
  </Step>
</Steps>

## Cherry-picking a commit

Cherry-picking lets you take a specific commit from the history and re-apply its changes into your current workspace. This is useful when you want to bring in a particular change without merging an entire branch.

Your workspace must have no uncommitted changes before cherry-picking. Cherry-picking is not available for the initial commit of a repository.

In the Desktop App:

<Steps>
  <Step title="Find the commit in Commits">
    Open the Commits view and find the commit you want to cherry-pick.
  </Step>

  <Step title="Cherry-pick the commit">
    Right-click on the commit and select "Cherry-pick into workspace".

    <img src="https://mintcdn.com/diversion-2/byT8FECKa2zLvaOH/images/branching-and-merging-cherry-pick-menu.png?fit=max&auto=format&n=byT8FECKa2zLvaOH&q=85&s=f133a8591f95052b34093825c5db286a" alt="Cherry-pick context menu option" width="976" height="604" data-path="images/branching-and-merging-cherry-pick-menu.png" />
  </Step>

  <Step title="Resolve conflicts if needed">
    If the cherry-picked changes conflict with your current workspace, you'll be taken to the merge conflict resolution view. See [merge conflicts](/basic/working-in-parallel#merge-conflicts) for details on resolving them.
  </Step>
</Steps>

Via the CLI, see the [cherry-pick command](/cmd-ref/cherry-pick) for details.

## Copying commit details

Need to reference a specific commit in a conversation or a script? You can quickly copy a commit's ID or message straight from the Commits view.

<Steps>
  <Step title="Copy commit ID">
    In the Commits view, click on the menu icon next to a commit and select "Copy commit ID". The ID is copied to your clipboard right away -- you'll see a "Copied commit ID" notification confirming it.

    <img src="https://mintcdn.com/diversion-2/byT8FECKa2zLvaOH/images/copy-commit-id-menu.png?fit=max&auto=format&n=byT8FECKa2zLvaOH&q=85&s=1fa0da937b32ec8e189ad07cd11383e5" alt="Copy commit ID menu option" style={{width: '90%', borderRadius: '1.5rem', border: '.3rem solid #555', boxShadow: '0 0 1rem #888' }} width="976" height="604" data-path="images/copy-commit-id-menu.png" />
  </Step>

  <Step title="Copy commit message">
    Similarly, you can select "Copy commit message" from the same menu to copy the full commit message text to your clipboard.
  </Step>
</Steps>
