# How to Revert to a Previous Commit in Github

> To revert to a previous commit in GitHub, open your repository's commit history on GitHub to copy the commit's unique ID using the clipboard icon. Then, open your terminal in Visual Studio Code, type git revert followed by the ID to create a new commit that undoes the changes while keeping your history intact.

Canonical: https://livedemo.ai/tutorials/how-to-revert-to-a-previous-commit-in-github/
Apps: GitHub
Updated: 2026-10-05
Interactive demo: https://story-api.livedemo.ai/workspaces/62255d3d3304f17b8f5e2d03/stories/692a4ca1ab56e05a00ff8292/preview?step=1

## Steps

1. Go to your repository on Github and click on the 'Commits' link.
2. You will be directed to the commit history and click on the clipboard icon to copy the unique ID of the commit you want to revert.
3. Go to the visual studio code, open up a terminal and type 'git revert' and past the unique ID or if it's a merge commit type m1 and paste the hash.
4. It creates a new commit that undoes the changes introduced by a specific commit. Your history remains intact.
5. By following these steps, you can easily revert a previous commit.
