ℹ️ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.2 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.gitkraken.com/learn/git/problems/revert-git-commit |
| Last Crawled | 2026-04-10 23:36:16 (6 days ago) |
| First Indexed | 2021-02-10 04:38:02 (5 years ago) |
| HTTP Status Code | 200 |
| Meta Title | Git Revert Commit | Solutions to Git Problems |
| Meta Description | Learn how to use Git revert to undo changes introduced in a specified commit or group of commits. See examples of Git revert commit in the terminal, GitKraken Client, & GitLens. |
| Meta Canonical | null |
| Boilerpipe Text | In this guide, we’ll delve into the practicalities of using the
git revert
command—a tool that developers frequently utilize to rectify past errors without losing work. Fundamentally, the
git revert
function produces an “equal but opposite” commit, effectively neutralizing the impact of a specific commit or group of commits. This approach to reversing mistakes is often safer and more efficient than using Git reset, which might remove or orphan commits in the commit history.
Throughout this article, we’ll explore the process of implementing a
git revert
in various environments—be it the terminal,
GitKraken Client
, or
GitLens for VS Code
. We’ll also introduce additional Git commands and workflows that developers can leverage to undo errors, offering insights on how to select the appropriate command based on your individual use case.
git revert
offers several advantages, making it an essential tool for any developer working with Git:
It provides a safe and effective means of undoing mistakes without the risk of losing work.
It doesn’t erase or orphan commits in the commit history.
git revert
is a forward-moving undo operation, implying that it doesn’t affect future commits.
Even for beginners,
git revert
is user-friendly and straightforward to use.
As a developer utilizing Git, understanding how to execute a
git revert
is a valuable skill. It can assist you in preventing work loss and maintaining a clean and well-organized codebase.Â
Take a look at these additional Git commands and workflows developers use to undo mistakes and how to determine which command to use based on your use case.Â
How to Perform a Git Revert Commit Using a Terminal
Â
How to Perform a Git Revert Commit Using GitKraken Client
How to Perform a Git Revert Commit Using GitLens for VS Code
Git ResetÂ
Git Rebase
Git Amend
Whether you prefer to use a GUI or CLI, GitKraken Client offers the best of both worlds and makes reverting commits faster, easier, and safer by giving you more control.
Download GitKraken Desktop Free
Available on:
Start free GitKraken Pro trial
Revert Git Commit in the Terminal
To undo a Git commit using a terminal, you’ll first need to identify the unique commit ID or SHA of the commit you want to undo. To find the commit ID for your targeted commit, run the following:
git log
Â
This will show you a list of your commits along with each commit’s unique ID. Next,
copy
the commit ID of the commit you want to revert.Â
Now run
git revert <commit ID>
. This creates a new commit that negates the commit you specified.Â
Git Revert Multiple Commits Using a Terminal
You can also revert a range of Git commits. To do this run the following:
git revert <older commit ID>..<newer commit ID>
The older commit should come first, followed by the newer commit. This will revert these two commits, plus any commit between them.Â
Git Revert Commit Using GitKraken Client
Reverting a Git commit can be done in just 2 clicks with the helpful visual context of GitKraken Client.Â
To revert a commit using GitKraken Client, simply right-click on the commit you want to revert from the central graph and select
Revert commit
from the context menu.Â
You will then be asked if you want to immediately commit the changes; from here you can choose to save the reverted commit, or select
No
to make additional code changes or change the Git commit message.Â
Pretty simple right? No need to remember complicated commit IDs or go through extra steps. Ready to try it out?
Download GitKraken Client
and test just how easy it is to revert a Git commit.Â
Git Revert Multiple Commits Using GitKraken Client
If you’re reverting more than one commit in GitKraken Client, you will need to revert them one at a time, and you should do so in order of newest to oldest. This will decrease the chance of introducing a conflict.Â
Git Revert Commit Using GitLens
If you’re a VS Code user,
GitLens
makes it easy to revert commits.Â
To revert a Git commit using GitLens complete the following:
Open your repo in VS Code
From the sidebar select
Source Control
Navigate to the
COMMITS
section
Right-click
on the commit you want to revert
Select the
Revert Commit
option
You can also access this option through the command palette by typing
>GitLens: Git Revert
or from the commit details’ quick pick menu.
Ready to give it a try?
Install GitLens
to stay organized and on track with your tasks and projects.Â
Additional Commands and Workflows to Undo a Commit
Even the most diligent of developers run into mistakes from time to time when working with Git repositories. But the process of fixing these mistakes can differ depending on the circumstances of each case. Furthermore, if you aren’t careful with how you undo these errors, you could end up losing work or messing up the work of your team members.Â
Thankfully, Git offers several tools that allow you to undo mistakes introduced by a commit. As with any other toolbox, it’s important to understand the purpose, advantages, and related risks of every tool before using them.Â
So let’s take a look at some other common Git commands developers use to undo their mistakes.
Quick Undo Using GitKraken Client
GitKraken Client makes it easy to undo/redo the following actions using the
undo
and
redo
buttons
in the top Toolbar:Â
Checkout
Commit
Discard
Delete branch
Remove remote
Reset branch to a commit
It’s important to note that the GitKraken Client undo button will only undo your most recent Git action. Undoing anything later than your most recent Git action will require the use of either Git revert, Git reset, or Git rebase.
Git Reset
While Git revert uses forward change to undo commits, the operation of Git reset is just the opposite.Â
Git reset is a way to move back in time to a particular commit, and to reset your active position to the chosen commit in a branch’s commit history.Â
However, just as science fiction movies depict, there are all sorts of side effects that can come from altering the course of history. For example, if you travel back to a commit with a reset, all the commits you passed may enter a dangling state where they exist but nothing references them. Furthermore, if you perform a “hard” reset, you can lose local work that wasn’t backed up properly.Â
If you need to make revisions to a commit that is not your last commit, the best solution is to create a new commit by reverting the old commit. As a Git best practice, you should avoid doing anything that will require you to force push — and rewrite the history — of your main branch(es).Â
Still determined to perform a Git reset? Here’s a
guide to help you Git reset
with as few issues as possible.Â
Git Rebase
Now, let’s say you want to undo a Git commit by going back in time, but you don’t want to completely reset history.
Rather than abandoning the commits after the erroneous commit, you want to apply them again and deal with the impacts of your changed history commit by commit.
For those who want a bit more manual control over the history revision process, Git provides the interactive rebase tool. With interactive rebase, you are presented with a list of commits up to a specified point on your branch’s history. From this point, you have various options for each commit:
Pick:
 you can keep the commit as-is in the history
Drop:
 remove the commit from the history
Squash:
 combine the commit with the one before it
Reword:
 change the commit message
Get step-by-step instructions on
how to perform a Git rebase
.
Git Amend
If you happen to catch a mistake immediately after you commit, you can quickly undo the error using the Git amend command. Perhaps you forgot to stage a file in the last commit, or had a typo in the commit message, or even made mistakes in the code, but have not yet committed anything else on top of it.
If you want to modify the last commit in your history, you have the ability to
amend the Git commit
with changes. For example, you can amend the previous commit by changing the Git commit message or description, or you can even stage a file you forgot to include.Â
Similarly, if there is a mistake in your previous commit’s code, you can fix the mistake and even add more changes before you amend it. Git amend is a single-commit undo tool which only affects the last commit in the branch’s history.Â
As with Git reset and Git rebase, amending is a history-rewriting process, or a reverse change, rather than a forward change. Under the hood, Git amend creates a brand new commit and replaces your last commit with the new one. It should therefore receive the same level of caution;Â once you have pushed a commit into a shared branch, amending that commit and pushing the amended change can result in side effects for anyone working off of that commit.
The Best Way to Change the Future
Undoing Git commits is a lot like modern depictions of time travel, with each Git command allowing you to change and affect history in a unique way. It’s up to you to determine which command fits your use case and apply it from there. Happy traveling!Â
Let’s do a final recap. Â
Git Revert
Does NOT rewrite your repos history
Neutralizes the effects of a specified commit or commit(s)
Usually the best command to use to “undo” a command when working with collaborators
Git Reset
Resets your active position to the chosen commit potentially deleting all commits that came afterÂ
Requires you to use a Git force pushÂ
Can cause problems for your teammatesÂ
Git Rebase
Essentially moves commits around and keeps some of your commit history
Using the Interactive rebase tool you can manually select what you want to do with each commit including pick, drop, squash, reword
Git Amend
“History-rewriting” command
Can only be performed on your latest commitÂ
Can be used to change a commit message, add a file, adjust code, etc.
GitKraken Client makes the process of reverting a Git commit simple and with far less risk. Do your workflow a favor and try GitKraken Client today.
Download GitKraken Desktop Free
Available on:
Start free GitKraken Pro trial |
| Markdown | 
GET 50% OFF GitKraken Pro! Ends Soon
[Take Advantage to Save](https://www.gitkraken.com/new-year-sale-2026)

[Claim 50% off →](https://www.gitkraken.com/new-year-sale-2026/)
[](https://www.gitkraken.com/)
- [Tools For How You Work](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- for developers
- [ GitKraken Desktop](https://www.gitkraken.com/git-client)
- [ GitLens for IDEs](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [VS Code](https://www.gitkraken.com/gitlens)
- [Cursor](https://www.gitkraken.com/gitlens/cursor)
- [Windsurf](https://www.gitkraken.com/gitlens/windsurf)
- [Trae](https://www.gitkraken.com/gitlens/trae)
- [Kiro](https://www.gitkraken.com/gitlens/kiro)
- *Jet Brains (Coming Soon)*
- [ GitKraken CLI](https://www.gitkraken.com/cli)
- [ GitKraken MCP](https://www.gitkraken.com/mcp)
for engineering leaders
- [ GitKraken Insights](https://www.gitkraken.com/insights)
- [ Dev Team Automations](https://www.gitkraken.com/features/automations)
- [ AI & Security Controls](https://www.gitkraken.com/solutions/enterprise-git-security)
- [ Git Integration for Jira](https://www.gitkraken.com/git-integration-for-jira)
- [Features](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- ## Built for Teams
A DevEx platform that’s built for team velocity & greater collaboration.
 Supercharge Your Dev Team \>
## Enterprise Grade
Solutions designed for large-scale security, privacy & control.
 Secure Your Dev Team \>
- [Commit Graph](https://www.gitkraken.com/features/commit-graph)
- [Launchpad](https://www.gitkraken.com/features/launchpad)
- [Workspaces](https://www.gitkraken.com/features/workspaces)
- [Code Suggest](https://www.gitkraken.com/features/code-suggestions)
- [Cloud Patches](https://www.gitkraken.com/features/cloud-patches)
- [GitKraken AI](https://www.gitkraken.com/features/git-ai)
- [Merge Tool](https://www.gitkraken.com/features/merge-conflict-resolution-tool)
- [Automations](https://www.gitkraken.com/features/automations)
- [Codemaps](https://www.gitkraken.com/features/code-dependency-mapping)
- [Security Controls](https://www.gitkraken.com/features/security-controls)
- [Solutions](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- - [Git Simplified](https://www.gitkraken.com/solutions/git-for-beginners)
- [Individual Productivity](https://www.gitkraken.com/solutions/developer-productivity)
- [Team Collaboration](https://www.gitkraken.com/solutions/development-team-collaboration)
- [PR & Code Review](https://www.gitkraken.com/solutions/code-review)
- [Developer Experience](https://www.gitkraken.com/solutions/developer-experience)
- [Continuous Understanding](https://www.gitkraken.com/solutions/continuous-understanding)
- [Sprint Planning & Execution](https://www.gitkraken.com/solutions/jira-sprint-planning-execution)
- [Team Productivity](https://www.gitkraken.com/solutions/jira-developer-productivity)
- [Dev Visibility](https://www.gitkraken.com/solutions/jira-development-visibility)
- [Jira Git Security](https://www.gitkraken.com/solutions/jira-git-security)
- [Security & Admin](https://www.gitkraken.com/solutions/enterprise-git-security)
- [Git Resources](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- - [GitKon](https://gitkon.com/)
- [Workshops](https://www.gitkraken.com/workshops)
- [Learn Git Library](https://www.gitkraken.com/learn/git)
- [Git Blog](https://www.gitkraken.com/blog)
- [Refer and Earn đź’°](https://www.gitkraken.com/referral-program)
- [Sample Customers](https://www.gitkraken.com/sample-customers)
- [Customer Stories](https://www.gitkraken.com/media#customer-stories)
- [Developer Problems](https://www.gitkraken.com/developer-problems)
- [GitKraken Labs](https://www.gitkraken.com/labs)
- [Help Center](https://help.gitkraken.com/)
- [Pricing](https://www.gitkraken.com/pricing)
- [Sign In](https://gitkraken.dev/login?source=marketing_page)
- [GitKraken Desktop features](https://www.gitkraken.com/git-client)
- [GitLens features](https://www.gitkraken.com/gitlens)
- [Git Integration for Jira features](https://www.gitkraken.com/git-integration-for-jira)
- [GiKraken CLI features](https://www.gitkraken.com/cli)
- [Pricing](https://www.gitkraken.com/pricing)
- [Sign up to start a free trial](https://gitkraken.dev/trial?source=marketing_page)
- [Learn Git Home](https://www.gitkraken.com/learn/git)
- [Git Concepts](https://www.gitkraken.com/learn/git#concepts)
- [Git Add](https://www.gitkraken.com/learn/git/git-add)
- [Git Branch](https://www.gitkraken.com/learn/git/branch)
- [Git Checkout](https://www.gitkraken.com/learn/git/git-checkout)
- [Git Cherry Pick](https://www.gitkraken.com/learn/git/cherry-pick)
- [Git Clone](https://www.gitkraken.com/learn/git/git-clone)
- [Git Commit](https://www.gitkraken.com/learn/git/commit)
- [Git Config](https://www.gitkraken.com/learn/git/git-config)
- [Git Diff](https://www.gitkraken.com/learn/git/git-diff)
- [Git Download](https://www.gitkraken.com/learn/git/git-download)
- [Git Fetch](https://www.gitkraken.com/learn/git/git-fetch)
- [Git Flow](https://www.gitkraken.com/learn/git/git-flow)
- [Git LFS](https://www.gitkraken.com/learn/git/git-lfs)
- [Git Merge](https://www.gitkraken.com/learn/git/git-merge)
- [Git Patch](https://www.gitkraken.com/learn/git/git-patch)
- [Git Push](https://www.gitkraken.com/learn/git/git-push)
- [Git Rebase](https://www.gitkraken.com/learn/git/git-rebase)
- [Git Remote](https://www.gitkraken.com/learn/git/git-remote)
- [Git Reset](https://www.gitkraken.com/learn/git/git-reset)
- [Git Squash](https://www.gitkraken.com/learn/git/git-squash)
- [Git Stash](https://www.gitkraken.com/learn/git/git-stash)
- [Git Worktree](https://www.gitkraken.com/learn/git/git-worktree)
- [Git Tutorials](https://www.gitkraken.com/learn/git/tutorials)
- [Beginner Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [What is a Git Repository?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-git-repository)
- [What is a Git Commit?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-commit)
- [How to Git Commit](https://www.gitkraken.com/learn/git/tutorials/how-to-git-commit)
- [What is a Git Remote?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-remote)
- [How to Git Branch](https://www.gitkraken.com/learn/git/tutorials/how-to-git-branch)
- [How to Create a Git Branch](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How to Delete a Git Branch](https://www.gitkraken.com/learn/git/tutorials/delete-git-branch)
- [How to Rename a Git Branch](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How Git SSH Works](https://www.gitkraken.com/learn/git/tutorials/how-git-ssh-works)
- [How Git Diff Works](https://www.gitkraken.com/learn/git/tutorials/what-is-a-diff)
- [What is Git Checkout?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-checkout)
- [What is Git Pull?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-pull)
- [Intermediate Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Git Merge](https://www.gitkraken.com/learn/git/tutorials/how-to-git-merge)
- [How to Git Stash](https://www.gitkraken.com/learn/git/tutorials/how-to-git-stash)
- [How to Create Git Hooks](https://www.gitkraken.com/learn/git/tutorials/how-to-create-git-hooks)
- [How to Git Squash](https://www.gitkraken.com/learn/git/tutorials/what-is-git-squash)
- [What is a Pull Request in Git?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-pull-request-in-git)
- [How to Git Cherry Pick](https://www.gitkraken.com/learn/git/tutorials/how-to-cherry-pick-git)
- [What is Git Rebase?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-rebase)
- [Advanced Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Resolve a Merge Conflict in Git](https://www.gitkraken.com/learn/git/tutorials/how-to-resolve-merge-conflict-in-git)
- [What is Git LFS?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-lfs)
- [What is a Git Submodule?](https://www.gitkraken.com/learn/git/tutorials/git-submodule-how-to)
- [Git Best Practices](https://www.gitkraken.com/learn/git/best-practices)
- [Clean Up History After Cherry Picking](https://www.gitkraken.com/learn/git/best-practices/clean-up-history-after-cherry-picking)
- [Writing a Good Git Commit Message](https://www.gitkraken.com/learn/git/best-practices/git-commit-message)
- [What is the best Git branch strategy?](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy)
- [Git Commands](https://www.gitkraken.com/learn/git/commands)
- [Git Definitions](https://www.gitkraken.com/learn/git/definitions)
- [Git Problems and Solutions](https://www.gitkraken.com/learn/git/problems)
- [Branching](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you create a branch in Git?](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How do you rename a Git branch?](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How do you switch a Git branch?](https://www.gitkraken.com/learn/git/problems/switch-git-branch)
- [How do you checkout a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/git-checkout-remote-branch)
- [How do you delete a local branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-local-git-branch)
- [How do you delete a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-remote-git-branch)
- [How do you view your Git branch list?](https://www.gitkraken.com/learn/git/problems/git-branch-list)
- [How do you merge a Git branch?](https://www.gitkraken.com/learn/git/problems/merge-git-branch)
- [How do you set an upstream branch in Git?](https://www.gitkraken.com/learn/git/problems/git-set-upstream-branch)
- [Git Pull Remote Branch](https://www.gitkraken.com/learn/git/problems/pull-remote-git-branch)
- [Checkout](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Checkout Commit](https://www.gitkraken.com/learn/git/problems/git-checkout-commit)
- [How do you checkout a Git tag?](https://www.gitkraken.com/learn/git/problems/git-checkout-tag)
- [Cherry Pick](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Can you cherry pick from another repository in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-from-another-repository)
- [Can you cherry pick multiple commits in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-multiple-commits)
- [Clone](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git clone a branch?](https://www.gitkraken.com/learn/git/problems/git-clone-branch)
- [Commit](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you revert a commit in Git?](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you amend a Git commit message?](https://www.gitkraken.com/learn/git/problems/git-commit-amend)
- [How do you undo a Git commit?](https://www.gitkraken.com/learn/git/problems/undo-git-commit)
- [Merge](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you undo a Git merge?](https://www.gitkraken.com/learn/git/problems/undo-git-merge)
- [Pull](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Pull vs Fetch](https://www.gitkraken.com/learn/git/problems/git-pull-vs-fetch)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you Git pull force?](https://www.gitkraken.com/learn/git/problems/git-pull-force)
- [How do you Git pull rebase?](https://www.gitkraken.com/learn/git/problems/git-pull-rebase)
- [Push](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git push a tag?](https://www.gitkraken.com/learn/git/problems/git-push-tag)
- [How do you Git push to a remote branch?](https://www.gitkraken.com/learn/git/problems/git-push-to-remote-branch)
- [How do you force a Git push?](https://www.gitkraken.com/learn/git/problems/git-push-force)
- [Rebase](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you perform an interactive rebase?](https://www.gitkraken.com/learn/git/problems/git-interactive-rebase)
- [When to Git rebase vs merge?](https://www.gitkraken.com/learn/git/problems/git-rebase-vs-merge)
- [How do you Git rebase a branch?](https://www.gitkraken.com/learn/git/problems/git-rebase-branch)
- [SSH](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [GitHub](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you delete a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-delete-repository)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [How do you fork a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-how-to-fork)
- [Learn Git Home](https://www.gitkraken.com/learn/git)
- [Git Concepts](https://www.gitkraken.com/learn/git#concepts)
- [Git Add](https://www.gitkraken.com/learn/git/git-add)
- [Git Branch](https://www.gitkraken.com/learn/git/branch)
- [Git Checkout](https://www.gitkraken.com/learn/git/git-checkout)
- [Git Cherry Pick](https://www.gitkraken.com/learn/git/cherry-pick)
- [Git Clone](https://www.gitkraken.com/learn/git/git-clone)
- [Git Commit](https://www.gitkraken.com/learn/git/commit)
- [Git Config](https://www.gitkraken.com/learn/git/git-config)
- [Git Diff](https://www.gitkraken.com/learn/git/git-diff)
- [Git Download](https://www.gitkraken.com/learn/git/git-download)
- [Git Fetch](https://www.gitkraken.com/learn/git/git-fetch)
- [Git Flow](https://www.gitkraken.com/learn/git/git-flow)
- [Git LFS](https://www.gitkraken.com/learn/git/git-lfs)
- [Git Merge](https://www.gitkraken.com/learn/git/git-merge)
- [Git Patch](https://www.gitkraken.com/learn/git/git-patch)
- [Git Push](https://www.gitkraken.com/learn/git/git-push)
- [Git Rebase](https://www.gitkraken.com/learn/git/git-rebase)
- [Git Remote](https://www.gitkraken.com/learn/git/git-remote)
- [Git Reset](https://www.gitkraken.com/learn/git/git-reset)
- [Git Squash](https://www.gitkraken.com/learn/git/git-squash)
- [Git Stash](https://www.gitkraken.com/learn/git/git-stash)
- [Git Worktree](https://www.gitkraken.com/learn/git/git-worktree)
- [Git Tutorials](https://www.gitkraken.com/learn/git/tutorials)
- [Beginner Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [What is a Git Repository?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-git-repository)
- [What is a Git Commit?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-commit)
- [How to Git Commit](https://www.gitkraken.com/learn/git/tutorials/how-to-git-commit)
- [What is a Git Remote?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-remote)
- [How to Git Branch](https://www.gitkraken.com/learn/git/tutorials/how-to-git-branch)
- [How to Create a Git Branch](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How to Delete a Git Branch](https://www.gitkraken.com/learn/git/tutorials/delete-git-branch)
- [How to Rename a Git Branch](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How Git SSH Works](https://www.gitkraken.com/learn/git/tutorials/how-git-ssh-works)
- [How Git Diff Works](https://www.gitkraken.com/learn/git/tutorials/what-is-a-diff)
- [What is Git Checkout?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-checkout)
- [What is Git Pull?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-pull)
- [Intermediate Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Git Merge](https://www.gitkraken.com/learn/git/tutorials/how-to-git-merge)
- [How to Git Stash](https://www.gitkraken.com/learn/git/tutorials/how-to-git-stash)
- [How to Create Git Hooks](https://www.gitkraken.com/learn/git/tutorials/how-to-create-git-hooks)
- [How to Git Squash](https://www.gitkraken.com/learn/git/tutorials/what-is-git-squash)
- [What is a Pull Request in Git?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-pull-request-in-git)
- [How to Git Cherry Pick](https://www.gitkraken.com/learn/git/tutorials/how-to-cherry-pick-git)
- [What is Git Rebase?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-rebase)
- [Advanced Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Resolve a Merge Conflict in Git](https://www.gitkraken.com/learn/git/tutorials/how-to-resolve-merge-conflict-in-git)
- [What is Git LFS?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-lfs)
- [What is a Git Submodule?](https://www.gitkraken.com/learn/git/tutorials/git-submodule-how-to)
- [Git Best Practices](https://www.gitkraken.com/learn/git/best-practices)
- [Clean Up History After Cherry Picking](https://www.gitkraken.com/learn/git/best-practices/clean-up-history-after-cherry-picking)
- [Writing a Good Git Commit Message](https://www.gitkraken.com/learn/git/best-practices/git-commit-message)
- [What is the best Git branch strategy?](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy)
- [Git Commands](https://www.gitkraken.com/learn/git/commands)
- [Git Definitions](https://www.gitkraken.com/learn/git/definitions)
- [Git Problems and Solutions](https://www.gitkraken.com/learn/git/problems)
- [Branching](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you create a branch in Git?](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How do you rename a Git branch?](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How do you switch a Git branch?](https://www.gitkraken.com/learn/git/problems/switch-git-branch)
- [How do you checkout a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/git-checkout-remote-branch)
- [How do you delete a local branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-local-git-branch)
- [How do you delete a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-remote-git-branch)
- [How do you view your Git branch list?](https://www.gitkraken.com/learn/git/problems/git-branch-list)
- [How do you merge a Git branch?](https://www.gitkraken.com/learn/git/problems/merge-git-branch)
- [How do you set an upstream branch in Git?](https://www.gitkraken.com/learn/git/problems/git-set-upstream-branch)
- [Git Pull Remote Branch](https://www.gitkraken.com/learn/git/problems/pull-remote-git-branch)
- [Checkout](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Checkout Commit](https://www.gitkraken.com/learn/git/problems/git-checkout-commit)
- [How do you checkout a Git tag?](https://www.gitkraken.com/learn/git/problems/git-checkout-tag)
- [Cherry Pick](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Can you cherry pick from another repository in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-from-another-repository)
- [Can you cherry pick multiple commits in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-multiple-commits)
- [Clone](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git clone a branch?](https://www.gitkraken.com/learn/git/problems/git-clone-branch)
- [Commit](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you revert a commit in Git?](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you amend a Git commit message?](https://www.gitkraken.com/learn/git/problems/git-commit-amend)
- [How do you undo a Git commit?](https://www.gitkraken.com/learn/git/problems/undo-git-commit)
- [Merge](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you undo a Git merge?](https://www.gitkraken.com/learn/git/problems/undo-git-merge)
- [Pull](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Pull vs Fetch](https://www.gitkraken.com/learn/git/problems/git-pull-vs-fetch)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you Git pull force?](https://www.gitkraken.com/learn/git/problems/git-pull-force)
- [How do you Git pull rebase?](https://www.gitkraken.com/learn/git/problems/git-pull-rebase)
- [Push](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git push a tag?](https://www.gitkraken.com/learn/git/problems/git-push-tag)
- [How do you Git push to a remote branch?](https://www.gitkraken.com/learn/git/problems/git-push-to-remote-branch)
- [How do you force a Git push?](https://www.gitkraken.com/learn/git/problems/git-push-force)
- [Rebase](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you perform an interactive rebase?](https://www.gitkraken.com/learn/git/problems/git-interactive-rebase)
- [When to Git rebase vs merge?](https://www.gitkraken.com/learn/git/problems/git-rebase-vs-merge)
- [How do you Git rebase a branch?](https://www.gitkraken.com/learn/git/problems/git-rebase-branch)
- [SSH](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [GitHub](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you delete a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-delete-repository)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [How do you fork a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-how-to-fork)
- [Learn Git Home](https://www.gitkraken.com/learn/git)
- [Git Concepts](https://www.gitkraken.com/learn/git#concepts)
- [Git Add](https://www.gitkraken.com/learn/git/git-add)
- [Git Branch](https://www.gitkraken.com/learn/git/branch)
- [Git Checkout](https://www.gitkraken.com/learn/git/git-checkout)
- [Git Cherry Pick](https://www.gitkraken.com/learn/git/cherry-pick)
- [Git Clone](https://www.gitkraken.com/learn/git/git-clone)
- [Git Commit](https://www.gitkraken.com/learn/git/commit)
- [Git Config](https://www.gitkraken.com/learn/git/git-config)
- [Git Diff](https://www.gitkraken.com/learn/git/git-diff)
- [Git Download](https://www.gitkraken.com/learn/git/git-download)
- [Git Fetch](https://www.gitkraken.com/learn/git/git-fetch)
- [Git Flow](https://www.gitkraken.com/learn/git/git-flow)
- [Git LFS](https://www.gitkraken.com/learn/git/git-lfs)
- [Git Merge](https://www.gitkraken.com/learn/git/git-merge)
- [Git Patch](https://www.gitkraken.com/learn/git/git-patch)
- [Git Push](https://www.gitkraken.com/learn/git/git-push)
- [Git Rebase](https://www.gitkraken.com/learn/git/git-rebase)
- [Git Remote](https://www.gitkraken.com/learn/git/git-remote)
- [Git Reset](https://www.gitkraken.com/learn/git/git-reset)
- [Git Squash](https://www.gitkraken.com/learn/git/git-squash)
- [Git Stash](https://www.gitkraken.com/learn/git/git-stash)
- [Git Worktree](https://www.gitkraken.com/learn/git/git-worktree)
- [Git Tutorials](https://www.gitkraken.com/learn/git/tutorials)
- [Beginner Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [What is a Git Repository?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-git-repository)
- [What is a Git Commit?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-commit)
- [How to Git Commit](https://www.gitkraken.com/learn/git/tutorials/how-to-git-commit)
- [What is a Git Remote?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-remote)
- [How to Git Branch](https://www.gitkraken.com/learn/git/tutorials/how-to-git-branch)
- [How to Create a Git Branch](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How to Delete a Git Branch](https://www.gitkraken.com/learn/git/tutorials/delete-git-branch)
- [How to Rename a Git Branch](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How Git SSH Works](https://www.gitkraken.com/learn/git/tutorials/how-git-ssh-works)
- [How Git Diff Works](https://www.gitkraken.com/learn/git/tutorials/what-is-a-diff)
- [What is Git Checkout?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-checkout)
- [What is Git Pull?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-pull)
- [Intermediate Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Git Merge](https://www.gitkraken.com/learn/git/tutorials/how-to-git-merge)
- [How to Git Stash](https://www.gitkraken.com/learn/git/tutorials/how-to-git-stash)
- [How to Create Git Hooks](https://www.gitkraken.com/learn/git/tutorials/how-to-create-git-hooks)
- [How to Git Squash](https://www.gitkraken.com/learn/git/tutorials/what-is-git-squash)
- [What is a Pull Request in Git?](https://www.gitkraken.com/learn/git/tutorials/what-is-a-pull-request-in-git)
- [How to Git Cherry Pick](https://www.gitkraken.com/learn/git/tutorials/how-to-cherry-pick-git)
- [What is Git Rebase?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-rebase)
- [Advanced Tutorials](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How to Resolve a Merge Conflict in Git](https://www.gitkraken.com/learn/git/tutorials/how-to-resolve-merge-conflict-in-git)
- [What is Git LFS?](https://www.gitkraken.com/learn/git/tutorials/what-is-git-lfs)
- [What is a Git Submodule?](https://www.gitkraken.com/learn/git/tutorials/git-submodule-how-to)
- [Git Best Practices](https://www.gitkraken.com/learn/git/best-practices)
- [Clean Up History After Cherry Picking](https://www.gitkraken.com/learn/git/best-practices/clean-up-history-after-cherry-picking)
- [Writing a Good Git Commit Message](https://www.gitkraken.com/learn/git/best-practices/git-commit-message)
- [What is the best Git branch strategy?](https://www.gitkraken.com/learn/git/best-practices/git-branch-strategy)
- [Git Commands](https://www.gitkraken.com/learn/git/commands)
- [Git Definitions](https://www.gitkraken.com/learn/git/definitions)
- [Git Problems and Solutions](https://www.gitkraken.com/learn/git/problems)
- [Branching](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you create a branch in Git?](https://www.gitkraken.com/learn/git/problems/create-git-branch)
- [How do you rename a Git branch?](https://www.gitkraken.com/learn/git/problems/rename-git-branch)
- [How do you switch a Git branch?](https://www.gitkraken.com/learn/git/problems/switch-git-branch)
- [How do you checkout a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/git-checkout-remote-branch)
- [How do you delete a local branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-local-git-branch)
- [How do you delete a remote branch in Git?](https://www.gitkraken.com/learn/git/problems/delete-remote-git-branch)
- [How do you view your Git branch list?](https://www.gitkraken.com/learn/git/problems/git-branch-list)
- [How do you merge a Git branch?](https://www.gitkraken.com/learn/git/problems/merge-git-branch)
- [How do you set an upstream branch in Git?](https://www.gitkraken.com/learn/git/problems/git-set-upstream-branch)
- [Git Pull Remote Branch](https://www.gitkraken.com/learn/git/problems/pull-remote-git-branch)
- [Checkout](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Checkout Commit](https://www.gitkraken.com/learn/git/problems/git-checkout-commit)
- [How do you checkout a Git tag?](https://www.gitkraken.com/learn/git/problems/git-checkout-tag)
- [Cherry Pick](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Can you cherry pick from another repository in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-from-another-repository)
- [Can you cherry pick multiple commits in Git?](https://www.gitkraken.com/learn/git/problems/cherry-pick-multiple-commits)
- [Clone](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git clone a branch?](https://www.gitkraken.com/learn/git/problems/git-clone-branch)
- [Commit](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you revert a commit in Git?](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you amend a Git commit message?](https://www.gitkraken.com/learn/git/problems/git-commit-amend)
- [How do you undo a Git commit?](https://www.gitkraken.com/learn/git/problems/undo-git-commit)
- [Merge](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you undo a Git merge?](https://www.gitkraken.com/learn/git/problems/undo-git-merge)
- [Pull](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [Git Pull vs Fetch](https://www.gitkraken.com/learn/git/problems/git-pull-vs-fetch)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you Git pull force?](https://www.gitkraken.com/learn/git/problems/git-pull-force)
- [How do you Git pull rebase?](https://www.gitkraken.com/learn/git/problems/git-pull-rebase)
- [Push](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you Git push a tag?](https://www.gitkraken.com/learn/git/problems/git-push-tag)
- [How do you Git push to a remote branch?](https://www.gitkraken.com/learn/git/problems/git-push-to-remote-branch)
- [How do you force a Git push?](https://www.gitkraken.com/learn/git/problems/git-push-force)
- [Rebase](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you perform an interactive rebase?](https://www.gitkraken.com/learn/git/problems/git-interactive-rebase)
- [When to Git rebase vs merge?](https://www.gitkraken.com/learn/git/problems/git-rebase-vs-merge)
- [How do you Git rebase a branch?](https://www.gitkraken.com/learn/git/problems/git-rebase-branch)
- [SSH](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [GitHub](https://www.gitkraken.com/learn/git/problems/revert-git-commit)
- [How do you delete a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-delete-repository)
- [How do you create a GitHub pull request?](https://www.gitkraken.com/learn/git/problems/github-pull-requests)
- [How do you add an SSH key to GitHub?](https://www.gitkraken.com/learn/git/problems/github-add-ssh-key)
- [How do you fork a GitHub repository?](https://www.gitkraken.com/learn/git/problems/github-how-to-fork)
# How to Revert a Git Commit
In this guide, we’ll delve into the practicalities of using the `git revert` command—a tool that developers frequently utilize to rectify past errors without losing work. Fundamentally, the `git revert` function produces an “equal but opposite” commit, effectively neutralizing the impact of a specific commit or group of commits. This approach to reversing mistakes is often safer and more efficient than using Git reset, which might remove or orphan commits in the commit history.
Throughout this article, we’ll explore the process of implementing a `git revert` in various environments—be it the terminal, [GitKraken Client](https://www.gitkraken.com/git-client), or [GitLens for VS Code](https://www.gitkraken.com/gitlens). We’ll also introduce additional Git commands and workflows that developers can leverage to undo errors, offering insights on how to select the appropriate command based on your individual use case.
`git revert` offers several advantages, making it an essential tool for any developer working with Git:
- It provides a safe and effective means of undoing mistakes without the risk of losing work.
- It doesn’t erase or orphan commits in the commit history.
- `git revert` is a forward-moving undo operation, implying that it doesn’t affect future commits.
- Even for beginners, `git revert` is user-friendly and straightforward to use.
As a developer utilizing Git, understanding how to execute a `git revert` is a valuable skill. It can assist you in preventing work loss and maintaining a clean and well-organized codebase.
Take a look at these additional Git commands and workflows developers use to undo mistakes and how to determine which command to use based on your use case.
[How to Perform a Git Revert Commit Using a Terminal](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-terminal)
[How to Perform a Git Revert Commit Using GitKraken Client](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-gitkraken-client)
[How to Perform a Git Revert Commit Using GitLens for VS Code](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-gitlens)
[Git Reset](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-reset)
[Git Rebase](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-rebase)
[Git Amend](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-rebase)
Whether you prefer to use a GUI or CLI, GitKraken Client offers the best of both worlds and makes reverting commits faster, easier, and safer by giving you more control.
[Download GitKraken Desktop Free](https://www.gitkraken.com/download)
Available on:
[Download GitKraken Client Windows / Mac / Linux](https://www.gitkraken.com/download)
[Start free GitKraken Pro trial](https://gitkraken.dev/trial?redirect_uri=https://www.gitkraken.com/typ/trial-start-success&source=marketing_page)
## Revert Git Commit in the Terminal
To undo a Git commit using a terminal, you’ll first need to identify the unique commit ID or SHA of the commit you want to undo. To find the commit ID for your targeted commit, run the following:
`git log`
This will show you a list of your commits along with each commit’s unique ID. Next, `copy` the commit ID of the commit you want to revert.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-11.55.45-AM.png)
Now run `git revert <commit ID>`. This creates a new commit that negates the commit you specified.
### **Git Revert Multiple Commits Using a Terminal**
You can also revert a range of Git commits. To do this run the following:
`git revert <older commit ID>..<newer commit ID>`
The older commit should come first, followed by the newer commit. This will revert these two commits, plus any commit between them.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-11.58.28-AM.png)
## Git Revert Commit Using GitKraken Client
Reverting a Git commit can be done in just 2 clicks with the helpful visual context of GitKraken Client.
To revert a commit using GitKraken Client, simply right-click on the commit you want to revert from the central graph and select `Revert commit` from the context menu.
You will then be asked if you want to immediately commit the changes; from here you can choose to save the reverted commit, or select `No` to make additional code changes or change the Git commit message.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-12.01.07-PM.png)
Pretty simple right? No need to remember complicated commit IDs or go through extra steps. Ready to try it out? [Download GitKraken Client](https://www.gitkraken.com/download) and test just how easy it is to revert a Git commit.
### **Git Revert Multiple Commits Using GitKraken Client**
If you’re reverting more than one commit in GitKraken Client, you will need to revert them one at a time, and you should do so in order of newest to oldest. This will decrease the chance of introducing a conflict.
## Git Revert Commit Using GitLens
If you’re a VS Code user, [GitLens](https://www.gitkraken.com/gitlens/try-free) makes it easy to revert commits.
To revert a Git commit using GitLens complete the following:
1. [Open your repo in VS Code](https://vscode.dev/)
2. From the sidebar select `Source Control`
3. Navigate to the `COMMITS` section
4. `Right-click` on the commit you want to revert
5. Select the `Revert Commit` option
[](https://www.gitkraken.com/wp-content/uploads/2022/03/gitlens-revert-commit-sidebar-1.png)
You can also access this option through the command palette by typing `>GitLens: Git Revert` or from the commit details’ quick pick menu.
[](https://www.gitkraken.com/wp-content/uploads/2022/03/gitlens-revert-commit-hover.png)
Ready to give it a try? [Install GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) to stay organized and on track with your tasks and projects.
## Additional Commands and Workflows to Undo a Commit
Even the most diligent of developers run into mistakes from time to time when working with Git repositories. But the process of fixing these mistakes can differ depending on the circumstances of each case. Furthermore, if you aren’t careful with how you undo these errors, you could end up losing work or messing up the work of your team members.
Thankfully, Git offers several tools that allow you to undo mistakes introduced by a commit. As with any other toolbox, it’s important to understand the purpose, advantages, and related risks of every tool before using them.
So let’s take a look at some other common Git commands developers use to undo their mistakes.
## Quick Undo Using GitKraken Client
GitKraken Client makes it easy to undo/redo the following actions using the [`undo` and `redo` buttons](https://help.gitkraken.com/gitkraken-client/undo-and-redo/) in the top Toolbar:
- Checkout
- Commit
- Discard
- Delete branch
- Remove remote
- Reset branch to a commit
It’s important to note that the GitKraken Client undo button will only undo your most recent Git action. Undoing anything later than your most recent Git action will require the use of either Git revert, Git reset, or Git rebase.
### **Git Reset**
While Git revert uses forward change to undo commits, the operation of Git reset is just the opposite.
Git reset is a way to move back in time to a particular commit, and to reset your active position to the chosen commit in a branch’s commit history.
However, just as science fiction movies depict, there are all sorts of side effects that can come from altering the course of history. For example, if you travel back to a commit with a reset, all the commits you passed may enter a dangling state where they exist but nothing references them. Furthermore, if you perform a “hard” reset, you can lose local work that wasn’t backed up properly.
If you need to make revisions to a commit that is not your last commit, the best solution is to create a new commit by reverting the old commit. As a Git best practice, you should avoid doing anything that will require you to force push — and rewrite the history — of your main branch(es).
Still determined to perform a Git reset? Here’s a [guide to help you Git reset](https://www.gitkraken.com/learn/git/git-reset) with as few issues as possible.
### **Git Rebase**
Now, let’s say you want to undo a Git commit by going back in time, but you don’t want to completely reset history.
Rather than abandoning the commits after the erroneous commit, you want to apply them again and deal with the impacts of your changed history commit by commit.
For those who want a bit more manual control over the history revision process, Git provides the interactive rebase tool. With interactive rebase, you are presented with a list of commits up to a specified point on your branch’s history. From this point, you have various options for each commit:
- **Pick:** you can keep the commit as-is in the history
- **Drop:** remove the commit from the history
- **Squash:** combine the commit with the one before it
- **Reword:** change the commit message
Get step-by-step instructions on [how to perform a Git rebase](https://www.gitkraken.com/learn/git/problems/git-interactive-rebase).
### **Git Amend**
If you happen to catch a mistake immediately after you commit, you can quickly undo the error using the Git amend command. Perhaps you forgot to stage a file in the last commit, or had a typo in the commit message, or even made mistakes in the code, but have not yet committed anything else on top of it.
If you want to modify the last commit in your history, you have the ability to [amend the Git commit](https://www.gitkraken.com/learn/git/problems/git-commit-amend) with changes. For example, you can amend the previous commit by changing the Git commit message or description, or you can even stage a file you forgot to include.
Similarly, if there is a mistake in your previous commit’s code, you can fix the mistake and even add more changes before you amend it. Git amend is a single-commit undo tool which only affects the last commit in the branch’s history.
As with Git reset and Git rebase, amending is a history-rewriting process, or a reverse change, rather than a forward change. Under the hood, Git amend creates a brand new commit and replaces your last commit with the new one. It should therefore receive the same level of caution; once you have pushed a commit into a shared branch, amending that commit and pushing the amended change can result in side effects for anyone working off of that commit.
## The Best Way to Change the Future
Undoing Git commits is a lot like modern depictions of time travel, with each Git command allowing you to change and affect history in a unique way. It’s up to you to determine which command fits your use case and apply it from there. Happy traveling\!
Let’s do a final recap.
**Git Revert**
- Does NOT rewrite your repos history
- Neutralizes the effects of a specified commit or commit(s)
- Usually the best command to use to “undo” a command when working with collaborators
**Git Reset**
- Resets your active position to the chosen commit potentially deleting all commits that came after
- Requires you to use a Git force push
- Can cause problems for your teammates
**Git Rebase**
- Essentially moves commits around and keeps some of your commit history
- Using the Interactive rebase tool you can manually select what you want to do with each commit including pick, drop, squash, reword
**Git Amend**
- “History-rewriting” command
- Can only be performed on your latest commit
- Can be used to change a commit message, add a file, adjust code, etc.
GitKraken Client makes the process of reverting a Git commit simple and with far less risk. Do your workflow a favor and try GitKraken Client today.
[Download GitKraken Desktop Free](https://www.gitkraken.com/download)
Available on:
[Download GitKraken Client Free Windows / Mac / Linux](https://www.gitkraken.com/download)
[Start free GitKraken Pro trial](https://gitkraken.dev/trial?redirect_uri=https://www.gitkraken.com/typ/trial-start-success&source=marketing_page)
### Additional Resources
[](https://www.gitkraken.com/blog/how-gitkrakens-ai-powered-commit-composer-eliminates-git-cleanup-headaches)
##### [How GitKraken’s AI-Powered Commit Composer Eliminates Git Cleanup Headaches](https://www.gitkraken.com/blog/how-gitkrakens-ai-powered-commit-composer-eliminates-git-cleanup-headaches)
[](https://www.gitkraken.com/learn/git/git-add)
##### [Git Add](https://www.gitkraken.com/learn/git/git-add)
[](https://www.gitkraken.com/learn/git/best-practices/git-commit-message)
##### [Writing a Good Git Commit Message](https://www.gitkraken.com/learn/git/best-practices/git-commit-message)
[](https://www.gitkraken.com/learn/git/problems/undo-git-commit)
##### [Undo Git Commit](https://www.gitkraken.com/learn/git/problems/undo-git-commit)
[](https://www.gitkraken.com/learn/git/problems/git-commit-amend)
##### [How do you amend a Git commit?](https://www.gitkraken.com/learn/git/problems/git-commit-amend)
[](https://www.gitkraken.com/learn/git/commit)
##### [Learn Git: Commit](https://www.gitkraken.com/learn/git/commit)
[](https://www.gitkraken.com/git-client?utm_campaign=Organic%20pages%3A%20Conversion%20optimization&utm_source=Organic%20traffic%20%28Learn%20pages%29&utm_medium=square%20ad)
Related Content
### [How GitKraken’s AI-Powered Commit Composer Eliminates Git Cleanup Headaches](https://www.gitkraken.com/blog/how-gitkrakens-ai-powered-commit-composer-eliminates-git-cleanup-headaches)
[Keep Reading »](https://www.gitkraken.com/blog/how-gitkrakens-ai-powered-commit-composer-eliminates-git-cleanup-headaches)
#### Table of Contents

**Products**
[Pricing](https://www.gitkraken.com/pricing)
[Help Center](https://help.gitkraken.com/)
[GitKraken AI](https://www.gitkraken.com/solutions/gitkraken-ai)
[**GitKraken Desktop**](https://www.gitkraken.com/git-client)
- [Login](https://gitkraken.dev/login?source=marketing_page)
- [Documentation](https://help.gitkraken.com/gitkraken-client/gitkraken-client-home/)
- [Release Notes](https://help.gitkraken.com/gitkraken-client/current/)
- [Roadmap](https://www.gitkraken.com/git-client/roadmap)
- [Feature Upvote](http://feedback.gitkraken.com/)
- [Cheat Sheet](https://www.gitkraken.com/pdfs/gitkraken-git-gui-cheat-sheet)
[**GitLens**](https://www.gitkraken.com/gitlens)
- [Documentation](https://help.gitkraken.com/gitlens/gitlens-home/)
- [GitLens for Cursor](https://www.gitkraken.com/gitlens/cursor)
- [GitLens for Windsurf](https://www.gitkraken.com/gitlens/windsurf)
- [GitLens for Trae](https://www.gitkraken.com/gitlens/trae)
- [GitLens for Kiro](https://www.gitkraken.com/gitlens/kiro)
[**GitKraken CLI**](https://www.gitkraken.com/cli)
[**Git Integration for Jira**](https://www.gitkraken.com/git-integration-for-jira)
- [Cloud Docs](https://help.gitkraken.com/git-integration-for-jira-cloud/git-integration-for-jira-home-gij-cloud/)
- [Data Center/Server Docs](https://help.gitkraken.com/git-integration-for-jira-data-center/git-integration-for-jira-home-self-manged/)
- [Security & Trust](https://trust.gitkraken.com/)
**Community**
[Referral Program](https://www.gitkraken.com/referral-program)
[Learn Git Library](https://www.gitkraken.com/learn/git)
[Git Commands Cheat Sheet](https://www.gitkraken.com/pdfs/git-basics-cheat-sheet)
[Git Blog](https://www.gitkraken.com/blog)
[GitKraken Labs](https://www.gitkraken.com/labs)
[Git Conference](http://gitkon.com/)
[Ambassador Program](https://www.gitkraken.com/ambassador)
[Newsletter](https://www.gitkraken.com/newsletter)
[Slack Community](https://www.gitkraken.com/join-slack-community)
[GitKraken for Students](https://www.gitkraken.com/github-student-developer-pack-bundle)
[Store](https://www.gitkraken.com/store)
[Keif Gallery](https://www.gitkraken.com/keif-gallery)
[Bug Bounty Program](https://www.gitkraken.com/bug-bounty-program)
**Company**
[Contact Us](https://www.gitkraken.com/contact)
[About Us](https://www.gitkraken.com/about)
[Careers](https://www.gitkraken.com/careers)
[Customers](https://www.gitkraken.com/sample-customers)
[Media](https://www.gitkraken.com/media)
[News](https://www.gitkraken.com/media/news)
[Awards](https://www.gitkraken.com/media/awards)
[Events](https://www.gitkraken.com/media/events)
[Press Releases](https://www.gitkraken.com/media/press)
[Logos](https://www.gitkraken.com/media/press-releases#logos)
[Privacy](https://www.gitkraken.com/privacy)
[Trust Center](https://trust.gitkraken.com/)
[Slack](https://www.gitkraken.com/join-slack-community) [Youtube](https://www.youtube.com/gitkraken) [Linkedin](https://www.linkedin.com/company/gitkraken)
**© 2026 Axosoft, LLC DBA GitKraken**
**Visual Studio Code is required to install GitLens.**
Don’t have Visual Studio Code? [Get it now](https://code.visualstudio.com/download).
[Continue to install GitLens](vscode:extension/eamodio.gitlens)
#### Team Collaboration Services
Secure cloud-backed services that span across all products in the DevEx platform to keep your workflows connected across projects, repos, and team members
**Launchpad** – All your PRs, issues, & tasks in one spot to kick off a focused, unblocked day. **Code Suggest** – Real code suggestions anywhere in your project, as simple as in Google Docs. **Cloud Patches** – Speed up PR reviews by enabling early collaboration on work-in-progress. **Workspaces** – Group & sync repos to simplify multi-repo actions, & get new devs coding faster. **DORA Insights** – Data-driven code insights to track & improve development velocity. **Security & Admin** – Easily set up SSO, manage access, & streamline IdP integrations.
[ Start Your Free Trial](https://gitkraken.dev/trial?redirect_uri=https://www.gitkraken.com/typ/trial-start-success&source=marketing_page)
#### GitKraken Browser Extension
Your bridge between apps
[Track PRs](https://www.gitkraken.com/browser-extension#track-prs) – [View PRs in GitKraken or VS Code](https://www.gitkraken.com/browser-extension#view-prs) – [Work More Effectively with Repo Providers](https://www.gitkraken.com/browser-extension#work-more-effectively)
[Add to Chrome](https://chrome.google.com/webstore/detail/gitkraken/egmopflbpgdjmmkeabegohajillnebco)
[Add to Firefox](https://addons.mozilla.org/en-US/firefox/addon/gitkraken-browser-extension/)
[Add to Microsoft Edge](https://microsoftedge.microsoft.com/addons/detail/gitkraken/eehliiniplilmbgcnghhaneefihofjnl)
#### GitLens for VS Code
Your IDE, Smarter with Git
40M+ INSTALLS
[Navigate Git, Minimize Mistakes](https://www.gitkraken.com/gitlens#navigate-git) – [Unblock PR & Code Reviews](https://www.gitkraken.com/gitlens#unblock-pr) – [Manage Multiple Repos](https://www.gitkraken.com/gitlens#manage-multiple-repos) – [Code with Momentum](https://www.gitkraken.com/gitlens#code-momentum)
[ Install GitLens in VS Code](https://www.gitkraken.com/learn/git/problems/revert-git-commit#elementor-action%3Aaction%3Dpopup%3Aopen%26settings%3DeyJpZCI6IjY0OTciLCJ0b2dnbGUiOmZhbHNlfQ%3D%3D)
#### GitKraken CLI
Ultimate CLI for Git Collaboration
[Bring PRs, WIPs & Issues to the Terminal](https://www.gitkraken.com/cli#bring-prs-to-terminal) – [Run Multi-Repo Commands](https://www.gitkraken.com/cli#run-multi-repo-commands) – [Manage Groups of Repos](https://www.gitkraken.com/cli#manage-groups-of-repos) – [Suggest Code Revisions](https://www.gitkraken.com/cli#suggest-code-revisions)
```
winget install gitkraken.cli
```
[Or download on GitHub](https://github.com/gitkraken/gk-cli/releases/latest)
#### GitKraken.dev
Your Command Center in the Browser
[Track PRs & Issues](https://www.gitkraken.com/gitkraken-dev#track-prs) – [Suggest and Share Code Changes](https://www.gitkraken.com/gitkraken-dev#suggest-send-code-changes) – [Ramp Up New Devs Faster](https://www.gitkraken.com/gitkraken-dev#ramp-up-new-devs) – [Bring Your Team Together](https://www.gitkraken.com/gitkraken-dev#bring-your-team-together) – [Secure and Control Your Data](https://www.gitkraken.com/gitkraken-dev#secure-control-data)
[Sign Into Your Account](https://gitkraken.dev/login?source=marketing_page)
[Sign up for free](https://gitkraken.dev/register?source=marketing_page)
#### GitKraken Desktop
Simplify Git For Any OS
[Visualize Git, Minimize Mistakes](https://www.gitkraken.com/git-client#visualize-git) – [Unblock PR & Code Reviews](https://www.gitkraken.com/git-client#unblock-pr) – [Manage Multiple Repos](https://www.gitkraken.com/git-client#manage-multiple-repos) – [Resolve Merge Conflicts with Ease](https://www.gitkraken.com/git-client#resolve-merge-conflicts) – [Ramp Up Devs Faster](https://www.gitkraken.com/git-client#ramp-up-new-devs)
[Download GitKraken Desktop Free](https://www.gitkraken.com/download)
Available on:
[Download GitKraken Windows / Mac / Linux](https://www.gitkraken.com/download)
[Start Free GitKraken Pro Trial](https://gitkraken.dev/trial?source=marketing_page) |
| Readable Markdown | In this guide, we’ll delve into the practicalities of using the `git revert` command—a tool that developers frequently utilize to rectify past errors without losing work. Fundamentally, the `git revert` function produces an “equal but opposite” commit, effectively neutralizing the impact of a specific commit or group of commits. This approach to reversing mistakes is often safer and more efficient than using Git reset, which might remove or orphan commits in the commit history.
Throughout this article, we’ll explore the process of implementing a `git revert` in various environments—be it the terminal, [GitKraken Client](https://www.gitkraken.com/git-client), or [GitLens for VS Code](https://www.gitkraken.com/gitlens). We’ll also introduce additional Git commands and workflows that developers can leverage to undo errors, offering insights on how to select the appropriate command based on your individual use case.
`git revert` offers several advantages, making it an essential tool for any developer working with Git:
- It provides a safe and effective means of undoing mistakes without the risk of losing work.
- It doesn’t erase or orphan commits in the commit history.
- `git revert` is a forward-moving undo operation, implying that it doesn’t affect future commits.
- Even for beginners, `git revert` is user-friendly and straightforward to use.
As a developer utilizing Git, understanding how to execute a `git revert` is a valuable skill. It can assist you in preventing work loss and maintaining a clean and well-organized codebase.
Take a look at these additional Git commands and workflows developers use to undo mistakes and how to determine which command to use based on your use case.
[How to Perform a Git Revert Commit Using a Terminal](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-terminal)
[How to Perform a Git Revert Commit Using GitKraken Client](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-gitkraken-client)
[How to Perform a Git Revert Commit Using GitLens for VS Code](https://www.gitkraken.com/learn/git/problems/revert-git-commit#revert-using-gitlens)
[Git Reset](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-reset)
[Git Rebase](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-rebase)
[Git Amend](https://www.gitkraken.com/learn/git/problems/revert-git-commit#git-rebase)
Whether you prefer to use a GUI or CLI, GitKraken Client offers the best of both worlds and makes reverting commits faster, easier, and safer by giving you more control.
[Download GitKraken Desktop Free](https://www.gitkraken.com/download)
Available on:
[Start free GitKraken Pro trial](https://gitkraken.dev/trial?redirect_uri=https://www.gitkraken.com/typ/trial-start-success&source=marketing_page)
## Revert Git Commit in the Terminal
To undo a Git commit using a terminal, you’ll first need to identify the unique commit ID or SHA of the commit you want to undo. To find the commit ID for your targeted commit, run the following:
`git log`
This will show you a list of your commits along with each commit’s unique ID. Next, `copy` the commit ID of the commit you want to revert.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-11.55.45-AM.png)
Now run `git revert <commit ID>`. This creates a new commit that negates the commit you specified.
### **Git Revert Multiple Commits Using a Terminal**
You can also revert a range of Git commits. To do this run the following:
`git revert <older commit ID>..<newer commit ID>`
The older commit should come first, followed by the newer commit. This will revert these two commits, plus any commit between them.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-11.58.28-AM.png)
## Git Revert Commit Using GitKraken Client
Reverting a Git commit can be done in just 2 clicks with the helpful visual context of GitKraken Client.
To revert a commit using GitKraken Client, simply right-click on the commit you want to revert from the central graph and select `Revert commit` from the context menu.
You will then be asked if you want to immediately commit the changes; from here you can choose to save the reverted commit, or select `No` to make additional code changes or change the Git commit message.
[](https://www.gitkraken.com/wp-content/uploads/2022/12/Screen-Shot-2022-12-15-at-12.01.07-PM.png)
Pretty simple right? No need to remember complicated commit IDs or go through extra steps. Ready to try it out? [Download GitKraken Client](https://www.gitkraken.com/download) and test just how easy it is to revert a Git commit.
### **Git Revert Multiple Commits Using GitKraken Client**
If you’re reverting more than one commit in GitKraken Client, you will need to revert them one at a time, and you should do so in order of newest to oldest. This will decrease the chance of introducing a conflict.
## Git Revert Commit Using GitLens
If you’re a VS Code user, [GitLens](https://www.gitkraken.com/gitlens/try-free) makes it easy to revert commits.
To revert a Git commit using GitLens complete the following:
1. [Open your repo in VS Code](https://vscode.dev/)
2. From the sidebar select `Source Control`
3. Navigate to the `COMMITS` section
4. `Right-click` on the commit you want to revert
5. Select the `Revert Commit` option
[](https://www.gitkraken.com/wp-content/uploads/2022/03/gitlens-revert-commit-sidebar-1.png)
You can also access this option through the command palette by typing `>GitLens: Git Revert` or from the commit details’ quick pick menu.
[](https://www.gitkraken.com/wp-content/uploads/2022/03/gitlens-revert-commit-hover.png)
Ready to give it a try? [Install GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens) to stay organized and on track with your tasks and projects.
## Additional Commands and Workflows to Undo a Commit
Even the most diligent of developers run into mistakes from time to time when working with Git repositories. But the process of fixing these mistakes can differ depending on the circumstances of each case. Furthermore, if you aren’t careful with how you undo these errors, you could end up losing work or messing up the work of your team members.
Thankfully, Git offers several tools that allow you to undo mistakes introduced by a commit. As with any other toolbox, it’s important to understand the purpose, advantages, and related risks of every tool before using them.
So let’s take a look at some other common Git commands developers use to undo their mistakes.
## Quick Undo Using GitKraken Client
GitKraken Client makes it easy to undo/redo the following actions using the [`undo` and `redo` buttons](https://help.gitkraken.com/gitkraken-client/undo-and-redo/) in the top Toolbar:
- Checkout
- Commit
- Discard
- Delete branch
- Remove remote
- Reset branch to a commit
It’s important to note that the GitKraken Client undo button will only undo your most recent Git action. Undoing anything later than your most recent Git action will require the use of either Git revert, Git reset, or Git rebase.
### **Git Reset**
While Git revert uses forward change to undo commits, the operation of Git reset is just the opposite.
Git reset is a way to move back in time to a particular commit, and to reset your active position to the chosen commit in a branch’s commit history.
However, just as science fiction movies depict, there are all sorts of side effects that can come from altering the course of history. For example, if you travel back to a commit with a reset, all the commits you passed may enter a dangling state where they exist but nothing references them. Furthermore, if you perform a “hard” reset, you can lose local work that wasn’t backed up properly.
If you need to make revisions to a commit that is not your last commit, the best solution is to create a new commit by reverting the old commit. As a Git best practice, you should avoid doing anything that will require you to force push — and rewrite the history — of your main branch(es).
Still determined to perform a Git reset? Here’s a [guide to help you Git reset](https://www.gitkraken.com/learn/git/git-reset) with as few issues as possible.
### **Git Rebase**
Now, let’s say you want to undo a Git commit by going back in time, but you don’t want to completely reset history.
Rather than abandoning the commits after the erroneous commit, you want to apply them again and deal with the impacts of your changed history commit by commit.
For those who want a bit more manual control over the history revision process, Git provides the interactive rebase tool. With interactive rebase, you are presented with a list of commits up to a specified point on your branch’s history. From this point, you have various options for each commit:
- **Pick:** you can keep the commit as-is in the history
- **Drop:** remove the commit from the history
- **Squash:** combine the commit with the one before it
- **Reword:** change the commit message
Get step-by-step instructions on [how to perform a Git rebase](https://www.gitkraken.com/learn/git/problems/git-interactive-rebase).
### **Git Amend**
If you happen to catch a mistake immediately after you commit, you can quickly undo the error using the Git amend command. Perhaps you forgot to stage a file in the last commit, or had a typo in the commit message, or even made mistakes in the code, but have not yet committed anything else on top of it.
If you want to modify the last commit in your history, you have the ability to [amend the Git commit](https://www.gitkraken.com/learn/git/problems/git-commit-amend) with changes. For example, you can amend the previous commit by changing the Git commit message or description, or you can even stage a file you forgot to include.
Similarly, if there is a mistake in your previous commit’s code, you can fix the mistake and even add more changes before you amend it. Git amend is a single-commit undo tool which only affects the last commit in the branch’s history.
As with Git reset and Git rebase, amending is a history-rewriting process, or a reverse change, rather than a forward change. Under the hood, Git amend creates a brand new commit and replaces your last commit with the new one. It should therefore receive the same level of caution; once you have pushed a commit into a shared branch, amending that commit and pushing the amended change can result in side effects for anyone working off of that commit.
## The Best Way to Change the Future
Undoing Git commits is a lot like modern depictions of time travel, with each Git command allowing you to change and affect history in a unique way. It’s up to you to determine which command fits your use case and apply it from there. Happy traveling\!
Let’s do a final recap.
**Git Revert**
- Does NOT rewrite your repos history
- Neutralizes the effects of a specified commit or commit(s)
- Usually the best command to use to “undo” a command when working with collaborators
**Git Reset**
- Resets your active position to the chosen commit potentially deleting all commits that came after
- Requires you to use a Git force push
- Can cause problems for your teammates
**Git Rebase**
- Essentially moves commits around and keeps some of your commit history
- Using the Interactive rebase tool you can manually select what you want to do with each commit including pick, drop, squash, reword
**Git Amend**
- “History-rewriting” command
- Can only be performed on your latest commit
- Can be used to change a commit message, add a file, adjust code, etc.
GitKraken Client makes the process of reverting a Git commit simple and with far less risk. Do your workflow a favor and try GitKraken Client today.
[Download GitKraken Desktop Free](https://www.gitkraken.com/download)
Available on:
[Start free GitKraken Pro trial](https://gitkraken.dev/trial?redirect_uri=https://www.gitkraken.com/typ/trial-start-success&source=marketing_page) |
| Shard | 29 (laksa) |
| Root Hash | 997466358027218229 |
| Unparsed URL | com,gitkraken!www,/learn/git/problems/revert-git-commit s443 |