ℹ️ 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 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.git-tower.com/learn/git/faq/undo-last-commit |
| Last Crawled | 2026-04-14 05:40:45 (4 hours ago) |
| First Indexed | 2015-12-18 13:53:48 (10 years ago) |
| HTTP Status Code | 200 |
| Meta Title | How can I undo the last commit? | Learn Version Control with Git |
| Meta Description | The easiest way to undo the last commit is by typing "git reset --soft HEAD~1". You can also specify the commit hash to revert to any previous revision. |
| Meta Canonical | null |
| Boilerpipe Text | Skip to main content
Features
Undo Anything
Just press Cmd+Z
Drag and Drop
Make the complex effortless
Integrations
Use your favorite tools
Tower Workflows
Branching Configurations
Stacked Pull Requests
Supercharged workflows
All Features
Release Notes
Pricing
Support
Documentation
Contact Us
Account Login
Learn Git
Video Course
24 episodes
Online Book
From novice to master
Cheat Sheets
For quick lookup
Webinar
Learn from a Git professional
First Aid Kit
Recover from mistakes
Advanced Git Kit
Dive deeper
Blog
Download
Download
In a hurry? Watch our brief
1-minute vertical video
that summarizes the info below.
First, before we bring the big guns in, let's make sure you really need them. Because in case you just want to
edit
your last commit, you can simply use Git's
amend
feature. It allows you to correct the last commit's message as well as add more changes to it. If that's what you want to do,
read more about amend
.
The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free!
Undoing the Last Commit
However, of course, there a tons of situations where you
really
want to undo that last commit. E.g. because you'd like to restructure it extensively - or even discard it altogether!
In these cases, the "reset" command is your best friend:
$ git reset --soft HEAD~1
Reset will rewind your current HEAD branch to the specified revision. In our example above, we'd like to return to the
one before the current
revision - effectively making our last commit undone.
Note the --soft flag: this makes sure that the
changes
in undone revisions are preserved. After running the command, you'll find the changes as uncommitted local modifications in your working copy.
If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.
$ git reset --hard HEAD~1
In case you're using the
Tower Git client
, you can simply hit
CMD+Z
(or
CTRL+Z
on Windows) to undo the last commit:
You can this familiar keyboard shortcut to
undo many other actions
, such as a failed merge or a deleted branch!
Undoing Multiple Commits
The same technique allows you to return to
any
previous revision:
$ git reset --hard 0ad5a7a6
Always keep in mind, however, that using the reset command undoes all commits that came after the one you returned to:
Learn More
Check out the chapter
Undoing Things
in our free online book
Get our popular
Git Cheat Sheet
for free!
You'll find the most important commands on the front and helpful best practice tips on the back. Over 100,000 developers have downloaded it to make Git a little bit easier.
About Us
As the makers of
Tower, the best Git client for Mac and Windows
, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
Just like with Tower, our mission with this platform is to help people become better professionals.
That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.
Cheat Sheets
Command Line 101
Git
Git for Subversion Users
HTML
Hugo
JavaScript
Markdown
PowerShell
Regex
Ruby on Rails
Tower Git Client
Visual Studio Code
Website Optimization
Workflow of Version Control
Working with Branches in Git
Xcode
Updates, Courses & Content via Email
Want to win one of our awesome Tower shirts?
Tell your friends about Tower!
We'll pick 4 winners every month who share this tweet!
Follow
@gittower
to be notified if you win! |
| Markdown | [Skip to main content](https://www.git-tower.com/learn/git/faq/undo-last-commit#main-content)
[Tower](https://www.git-tower.com/)
Navigation
- [Features](https://www.git-tower.com/features)
- [Undo Anything Just press Cmd+Z](https://www.git-tower.com/features/undo)
- [Drag and Drop Make the complex effortless](https://www.git-tower.com/features/drag-and-drop)
- [Integrations Use your favorite tools](https://www.git-tower.com/features/integrations)
- [Tower Workflows Branching Configurations](https://www.git-tower.com/features/workflows)
- [Stacked Pull Requests Supercharged workflows](https://www.git-tower.com/features/stacked-prs)
- [All Features](https://www.git-tower.com/features/all-features)
- [Release Notes](https://www.git-tower.com/release-notes)
- [Pricing](https://www.git-tower.com/pricing)
- [Support](https://www.git-tower.com/support)
- [Documentation](https://www.git-tower.com/help)
- [Contact Us](https://www.git-tower.com/support/contact)
- [Account Login](https://account.git-tower.com/)
- [Learn Git](https://www.git-tower.com/learn)
- [Video Course 24 episodes](https://www.git-tower.com/learn/git/videos)
- [Online Book From novice to master](https://www.git-tower.com/learn/git/ebook)
- [Cheat Sheets For quick lookup](https://www.git-tower.com/learn/cheat-sheets)
- [Webinar Learn from a Git professional](https://www.git-tower.com/learn/git/webinar)
- [First Aid Kit Recover from mistakes](https://www.git-tower.com/learn/git/first-aid-kit)
- [Advanced Git Kit Dive deeper](https://www.git-tower.com/learn/git/advanced-git-kit)
- [Blog](https://www.git-tower.com/blog)
- [Download](https://www.git-tower.com/download/mac) [Download](https://www.git-tower.com/download/windows)
Git FAQ
Frequently asked questions around Git and Version Control.

# How can I undo the last commit?
In a hurry? Watch our brief [1-minute vertical video](https://youtube.com/shorts/ZETGF-TDyqQ?feature=share) that summarizes the info below.
First, before we bring the big guns in, let's make sure you really need them. Because in case you just want to **edit** your last commit, you can simply use Git's *amend* feature. It allows you to correct the last commit's message as well as add more changes to it. If that's what you want to do, [read more about amend](https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/undoing-things#start).

## The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free\!
[Download Now for Free]()
## Undoing the Last Commit
However, of course, there a tons of situations where you *really* want to undo that last commit. E.g. because you'd like to restructure it extensively - or even discard it altogether\!
In these cases, the "reset" command is your best friend:
```
$ git reset --soft HEAD~1
```
Reset will rewind your current HEAD branch to the specified revision. In our example above, we'd like to return to the *one before the current* revision - effectively making our last commit undone.
Note the --soft flag: this makes sure that the *changes* in undone revisions are preserved. After running the command, you'll find the changes as uncommitted local modifications in your working copy.
If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.
```
$ git reset --hard HEAD~1
```
In case you're using the [Tower Git client](https://www.git-tower.com/?utm_source=learn-website&utm_campaign=git-faq&utm_medium=easy-in-tower&utm_content=undo-last-commit), you can simply hit **CMD+Z** (or **CTRL+Z** on Windows) to undo the last commit:
You can this familiar keyboard shortcut to [undo many other actions](https://www.git-tower.com/features/undo/), such as a failed merge or a deleted branch\!
## Undoing Multiple Commits
The same technique allows you to return to *any* previous revision:
```
$ git reset --hard 0ad5a7a6
```
Always keep in mind, however, that using the reset command undoes all commits that came after the one you returned to:

### Learn More
- Check out the chapter [Undoing Things](https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/undoing-things) in our free online book
***
### Related Questions
- [Editing / fixing the last commit's message](https://www.git-tower.com/learn/git/faq/edit-fix-commit-message)
- [Undoing a specific old commit](https://www.git-tower.com/learn/git/faq/undo-revert-old-commit)
- [Changing the author (name / email) of a commit](https://www.git-tower.com/learn/git/faq/change-author-name-email)
- [Deleting commits in Git](https://www.git-tower.com/learn/git/faq/delete-commits)
- [Using cherry-pick to integrate individual commits](https://www.git-tower.com/learn/git/faq/cherry-pick)
- [How to checkout a commit in Git](https://www.git-tower.com/learn/git/faq/git-checkout-commits)
- [How to squash commits in Git](https://www.git-tower.com/learn/git/faq/git-squash)
- [How to Create and Push an Empty Commit in Git](https://www.git-tower.com/learn/git/faq/git-empty-commit)
For additional Git-related questions (and answers!), visit our [FAQ homepage](https://www.git-tower.com/learn/git/faq).
## Get our popular **Git Cheat Sheet** for free\!
You'll find the most important commands on the front and helpful best practice tips on the back. Over 100,000 developers have downloaded it to make Git a little bit easier.

## About Us
As the makers of [Tower, the best Git client for Mac and Windows](https://www.git-tower.com/?utm_source=learn-website&utm_medium=about-us&utm_campaign=learn-git), we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
Just like with Tower, our mission with this platform is to help people become better professionals.
That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.
[](https://www.git-tower.com/?utm_source=learn-website&utm_medium=about-us&utm_campaign=learn-git)
About
- [About](https://www.git-tower.com/company/about)
- [Blog](https://www.git-tower.com/blog)
- [Merch](https://stuff.git-tower.com/)
- [Tower Git Client](https://www.git-tower.com/)
Git & Version Control
- [Online Book](https://www.git-tower.com/learn/git/ebook)
- [First Aid Kit](https://www.git-tower.com/learn/git/first-aid-kit)
- [Webinar](https://www.git-tower.com/learn/git/webinar)
- [Video Course](https://www.git-tower.com/learn/git/videos)
- [Advanced Git Kit](https://www.git-tower.com/learn/git/advanced-git-kit)
- [FAQ](https://www.git-tower.com/learn/git/faq)
- [Glossary](https://www.git-tower.com/learn/git/glossary)
- [Commands](https://www.git-tower.com/learn/git/commands)
Cheat Sheets
- [Command Line 101](https://www.git-tower.com/learn/cheat-sheets/cli)
- [Git](https://www.git-tower.com/learn/cheat-sheets/git)
- [Git for Subversion Users](https://www.git-tower.com/learn/cheat-sheets/git-for-svn)
- [HTML](https://www.git-tower.com/learn/cheat-sheets/html)
- [Hugo](https://www.git-tower.com/learn/cheat-sheets/hugo)
- [JavaScript](https://www.git-tower.com/learn/cheat-sheets/javascript)
- [Markdown](https://www.git-tower.com/learn/cheat-sheets/markdown)
- [PowerShell](https://www.git-tower.com/learn/cheat-sheets/powershell)
- [Regex](https://www.git-tower.com/learn/cheat-sheets/regex)
- [Ruby on Rails](https://www.git-tower.com/learn/cheat-sheets/ruby-on-rails)
- [Tower Git Client](https://www.git-tower.com/learn/cheat-sheets/tower)
- [Visual Studio Code](https://www.git-tower.com/learn/cheat-sheets/vscode)
- [Website Optimization](https://www.git-tower.com/learn/cheat-sheets/website-optimization)
- [Workflow of Version Control](https://www.git-tower.com/learn/cheat-sheets/vcs-workflow)
- [Working with Branches in Git](https://www.git-tower.com/learn/cheat-sheets/git-branches)
- [Xcode](https://www.git-tower.com/learn/cheat-sheets/xcode)
## Your trial is downloading…
Try Tower "Pro" for 30 days without limitations\!
 Tower
Close
## Updates, Courses & Content via Email
## Thank you for subscribing
Please check your email to confirm
Close
## Want to win one of our awesome Tower shirts? **Tell your friends about Tower\!**
[Share on Twitter](https://www.git-tower.com/learn/git/faq/undo-last-commit)
We'll pick 4 winners every month who share this tweet\!
Follow [@gittower](https://x.com/gittower) to be notified if you win\!
## Try Tower for Free
Sign up below and use Tower "Pro" for 30 days without limitations\!
Close
[Imprint / Legal Notice](https://www.git-tower.com/legal/imprint) \| [Privacy Policy](https://www.git-tower.com/legal/privacy-policy) \| Privacy Settings
© 2010-2026 [Tower](https://www.git-tower.com/) - Mentioned product names and logos are property of their respective owners. |
| Readable Markdown | [Skip to main content](https://www.git-tower.com/learn/git/faq/undo-last-commit#main-content)
- [Features](https://www.git-tower.com/features)
- [Undo Anything Just press Cmd+Z](https://www.git-tower.com/features/undo)
- [Drag and Drop Make the complex effortless](https://www.git-tower.com/features/drag-and-drop)
- [Integrations Use your favorite tools](https://www.git-tower.com/features/integrations)
- [Tower Workflows Branching Configurations](https://www.git-tower.com/features/workflows)
- [Stacked Pull Requests Supercharged workflows](https://www.git-tower.com/features/stacked-prs)
- [All Features](https://www.git-tower.com/features/all-features)
- [Release Notes](https://www.git-tower.com/release-notes)
- [Pricing](https://www.git-tower.com/pricing)
- [Support](https://www.git-tower.com/support)
- [Documentation](https://www.git-tower.com/help)
- [Contact Us](https://www.git-tower.com/support/contact)
- [Account Login](https://account.git-tower.com/)
- [Learn Git](https://www.git-tower.com/learn)
- [Video Course 24 episodes](https://www.git-tower.com/learn/git/videos)
- [Online Book From novice to master](https://www.git-tower.com/learn/git/ebook)
- [Cheat Sheets For quick lookup](https://www.git-tower.com/learn/cheat-sheets)
- [Webinar Learn from a Git professional](https://www.git-tower.com/learn/git/webinar)
- [First Aid Kit Recover from mistakes](https://www.git-tower.com/learn/git/first-aid-kit)
- [Advanced Git Kit Dive deeper](https://www.git-tower.com/learn/git/advanced-git-kit)
- [Blog](https://www.git-tower.com/blog)
- [Download](https://www.git-tower.com/download/mac) [Download](https://www.git-tower.com/download/windows)
In a hurry? Watch our brief [1-minute vertical video](https://youtube.com/shorts/ZETGF-TDyqQ?feature=share) that summarizes the info below.
First, before we bring the big guns in, let's make sure you really need them. Because in case you just want to **edit** your last commit, you can simply use Git's *amend* feature. It allows you to correct the last commit's message as well as add more changes to it. If that's what you want to do, [read more about amend](https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/undoing-things#start).

## The Git Cheat Sheet
No need to remember all those commands and parameters: get our popular "Git Cheat Sheet" - for free\!
## Undoing the Last Commit
However, of course, there a tons of situations where you *really* want to undo that last commit. E.g. because you'd like to restructure it extensively - or even discard it altogether\!
In these cases, the "reset" command is your best friend:
```
$ git reset --soft HEAD~1
```
Reset will rewind your current HEAD branch to the specified revision. In our example above, we'd like to return to the *one before the current* revision - effectively making our last commit undone.
Note the --soft flag: this makes sure that the *changes* in undone revisions are preserved. After running the command, you'll find the changes as uncommitted local modifications in your working copy.
If you don't want to keep these changes, simply use the --hard flag. Be sure to only do this when you're sure you don't need these changes anymore.
```
$ git reset --hard HEAD~1
```
In case you're using the [Tower Git client](https://www.git-tower.com/?utm_source=learn-website&utm_campaign=git-faq&utm_medium=easy-in-tower&utm_content=undo-last-commit), you can simply hit **CMD+Z** (or **CTRL+Z** on Windows) to undo the last commit:
You can this familiar keyboard shortcut to [undo many other actions](https://www.git-tower.com/features/undo/), such as a failed merge or a deleted branch\!
## Undoing Multiple Commits
The same technique allows you to return to *any* previous revision:
```
$ git reset --hard 0ad5a7a6
```
Always keep in mind, however, that using the reset command undoes all commits that came after the one you returned to:

### Learn More
- Check out the chapter [Undoing Things](https://www.git-tower.com/learn/git/ebook/en/command-line/advanced-topics/undoing-things) in our free online book
## Get our popular **Git Cheat Sheet** for free\!
You'll find the most important commands on the front and helpful best practice tips on the back. Over 100,000 developers have downloaded it to make Git a little bit easier.

## About Us
As the makers of [Tower, the best Git client for Mac and Windows](https://www.git-tower.com/?utm_source=learn-website&utm_medium=about-us&utm_campaign=learn-git), we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
Just like with Tower, our mission with this platform is to help people become better professionals.
That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.
[](https://www.git-tower.com/?utm_source=learn-website&utm_medium=about-us&utm_campaign=learn-git)
Cheat Sheets
- [Command Line 101](https://www.git-tower.com/learn/cheat-sheets/cli)
- [Git](https://www.git-tower.com/learn/cheat-sheets/git)
- [Git for Subversion Users](https://www.git-tower.com/learn/cheat-sheets/git-for-svn)
- [HTML](https://www.git-tower.com/learn/cheat-sheets/html)
- [Hugo](https://www.git-tower.com/learn/cheat-sheets/hugo)
- [JavaScript](https://www.git-tower.com/learn/cheat-sheets/javascript)
- [Markdown](https://www.git-tower.com/learn/cheat-sheets/markdown)
- [PowerShell](https://www.git-tower.com/learn/cheat-sheets/powershell)
- [Regex](https://www.git-tower.com/learn/cheat-sheets/regex)
- [Ruby on Rails](https://www.git-tower.com/learn/cheat-sheets/ruby-on-rails)
- [Tower Git Client](https://www.git-tower.com/learn/cheat-sheets/tower)
- [Visual Studio Code](https://www.git-tower.com/learn/cheat-sheets/vscode)
- [Website Optimization](https://www.git-tower.com/learn/cheat-sheets/website-optimization)
- [Workflow of Version Control](https://www.git-tower.com/learn/cheat-sheets/vcs-workflow)
- [Working with Branches in Git](https://www.git-tower.com/learn/cheat-sheets/git-branches)
- [Xcode](https://www.git-tower.com/learn/cheat-sheets/xcode)
## Updates, Courses & Content via Email
## Want to win one of our awesome Tower shirts? **Tell your friends about Tower\!**
We'll pick 4 winners every month who share this tweet\!
Follow [@gittower](https://x.com/gittower) to be notified if you win\! |
| Shard | 63 (laksa) |
| Root Hash | 2236478454510524063 |
| Unparsed URL | com,git-tower!www,/learn/git/faq/undo-last-commit s443 |