Command

Git Revert a Commit Command

The Git command to revert a commit is git revert <commit>.

Quick Answer

Command
git revert <commit>
GitCommand

Revert a Commit

Type this command
git revert <commit>

Creates a new commit that undoes an earlier commit.

Learn More

How to revert a commit in Git

  1. Open the terminal or command interface for Git.
  2. Type git revert <commit>, replace any placeholders, and run it.

Git Revert a Commit Command

Run git revert <commit>.

Related Commands

Frequently asked questions

What is the Git command to revert a commit?

Run git revert <commit>.

Where do I type this Git command?

Type it in the terminal or command-line interface used by Git.

Does this Git command work on Mac and Windows?

Yes. The command text is the same on both platforms when the tool is installed.

Official source · How we verify