Skip to main content

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.
1

Go to your repo history

Open the workspace of the repo where your changes are. Make sure that you have no pending changes. On the left-hand side, click on the “History” tab.
2

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.Undo commit
3

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:Reverted commitAnd this is the resulting change in my workspace:Workspace after commit revert
4

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.Workspace after commit revertThis will result in a merge conflict, which you’ll have to resolve before you can commit the changes.Workspace after commit revert

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 History view.
Editing commit messages is only available for the commit author, and is not supported for repositories synced with Git.
1

Open the commit menu

In the History view, click on the menu icon next to the commit whose message you want to change, and select “Edit commit message”.Edit commit message menu option
2

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.Edit commit message dialog

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:
1

Find the commit in History

Open the History view and find the commit you want to cherry-pick.
2

Cherry-pick the commit

Right-click on the commit and select “Cherry-pick into workspace”.Cherry-pick context menu option
3

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 for details on resolving them.
Via the CLI, see the cherry-pick command 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 History view.
1

Copy commit ID

In the History 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.Copy commit ID menu option
2

Copy commit message

Similarly, you can select “Copy commit message” from the same menu to copy the full commit message text to your clipboard.