You’ve been working on your project for a while, and you realize that you made a mistake a few commits ago. Or maybe you want to start a new feature based on an older version of your project. No worries! You can go back in time to a previous commit.

Reverting to a previous commit

One way to go back in time is to revert to a previous commit. This will create changes in your workspace that undo all of the commits from the commit you’ve chosen to revert to up to the current commit. This does not create a new commit!

1

Make sure you have no pending changes

Since this action will automatically create changes in your workspace, it must be clean beforehand. Undo or commit any changes you have.

2

Revert the chosen commit

In the History view, click on the menu for the commit you want to revert to and select Revert to this commit.

3

Review the changes and commit

You’ll be redirected to the Workspace view where you’ll see the changes that will be made.

Branching from a previous commit

Another way to go back in time is to create a new branch from a previous commit. This will create a new branch with the commit you’ve chosen as the base.

1

Choose which commit you want as the base for your new branch

2

Create a branch

Follow the steps to create a new branch, as described in Working in parallel.