You may find you're in a situation where you need to revert the repository to a previous commit. This can be done using the following command:

```bash 
$ git revert 8fd3350cf6
```

Where `8fd3350cf6` is the old commit you're reverting _back to_. You'll be prompted to review and add a commit message for the revert, but you can leave the default message as it is:

```bash
Revert "Add the correct link to Brie"

This reverts commit 8fd3350cf6fba8bcd4abc7233d4ff6b81dd6ed3c.

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch my_new_branch
# Your branch and 'origin/my_new_branch' have diverged,
# and have 1 and 1 different commits each, respectively.
#   (use "git pull" to merge the remote branch into yours)
#
# Changes to be committed:
#       modified:   index.html
#
```

Then type `ctrl+x`, followed by the enter key to save it. You'll then see a confirmation message showing that you've reverted successfully:

```bash
[my_new_branch 8655d60] Revert "Add the correct link to Brie"
 1 file changed, 1 insertion(+), 1 deletion(-)
 ```

You can use [`git log`](/git/viewing-previous-commits) to verify the revert commit was added to your history.

If you only need to undo your very last commit, see [how to undo your last commit](/git/faqs/undo-last-git-commit). For a deeper look at when to use `revert` versus [`git reset`](/git/commands/git-reset), read about the [difference between git reset and git revert](/git/faqs/difference-git-reset-revert).

Ready to streamline your Git workflow? [DeployHQ](https://www.deployhq.com) deploys your code automatically whenever you push to your repository.