If you go to Changelist -> Log, and there select the commit, you've got a change detail in the right panel. There you can select all and click a button (or right click -> revert selected changes).

Answer from c0stra on Stack Overflow
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ undo-changes.html
Undo changes in Git repository | IntelliJ IDEA Documentation
May 5, 2026 - IntelliJ IDEA allows you to undo the last commit in the current branch. You cannot undo a commit if it was pushed to a protected branch, that is a branch to which force --push is not allowed (configure protected branches in the Version Control | Git settings page Ctrl+Alt+S) Note that if a branch is marked as protected on GitHub, IntelliJ IDEA will automatically mark it as protected when you check it out.
Discussions

How to revert my git remote branch into previous commit in intelliJ? - Stack Overflow
I had already one PULL Request. After rebasing my feature branch with the master I changed some files and commit it and pushed into my remote feature branch. During push IntelliJ told me to rebase ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Git + Intellij - How to revert a local commit? - Stack Overflow
Working with git and intellij I have accidently commmited my changes to my local branch. I want to revert the commmit but keep the changes as before (ready for next commit). I have looked in thi... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Undo multiple commits but keep local changes.

You can reset the head on your checked out branch to any hash you'd like in your history. It won't make changes to the files in your workspace without the -hard flag, so just do a reset to whatever commit you'd like, without passing it -hard.

This, of course, ignores whatever "Intellij" is, but you asked a question in "r/git", and that's how what you asked is addressed with Git.

More on reddit.com
๐ŸŒ r/git
9
6
April 27, 2021
intellij idea - How to revert a unpushed git commit - Stack Overflow
I am using Idea IntelliJ Community Edition 2016 and committed a change to GIT. But I have not pushed it. Now when I see my push queue I can see it in the queue. I tried RESET HEAD option but it did... More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
JetBrains
jetbrains.com โ€บ guide โ€บ tips โ€บ undo-last-commit
Undo your Last Commit - JetBrains Guide
February 17, 2023 - In the Git tool window, find the most recent commit. Itโ€™s the one at the top. When we select it, we get more detail about the commit. We can double-click the file to see a diff of the change. When you right-click on a commit, you get some actions you can take on it. Some might be grayed-out. For example, if we right-click on an older, pushed commit, weโ€™ll see โ€œUndo Commitโ€ is grayed-out.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to revert any commit in git in Intellij IDEA - YouTube
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
Published ย  March 15, 2016
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 58875508 โ€บ how-to-revert-my-git-remote-branch-into-previous-commit-in-intellij
How to revert my git remote branch into previous commit in intelliJ? - Stack Overflow
I think the easiest solution would be to create another branch off of master (or whatever your PR is going into) and do a git merge --squash to make it a single new commit then restart your PR.
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 206884545-How-to-undo-a-commit-in-a-local-branch-git
How to undo a commit in a local branch - git โ€“ IDEs Support (IntelliJ Platform) | JetBrains
January 30, 2013 - To undo local unpushed commits in Git you have to use the reset command. If you want to keep code changes, you need the "mixed" mode (which is the default mode). There is also VCS | Git | Reset HEAD action in IntelliJ IDEA, but it doesn't support ...
Find elsewhere
๐ŸŒ
lulitrail
lulitrail.weebly.com โ€บ sourcetree-revert-to-previous-commit.html
Sourcetree revert to previous commit - lulitrail
Locate the commit you want to revert in the Log tab of the Git tool window Alt+9, right-click it and select Revert Commit from the context menu. Thus, project history is preserved, as the original commit remains intact.
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 4402770373650-Reset-a-single-file-only-to-a-specific-commit
Reset a single file only to a specific commit โ€“ IDEs Support (IntelliJ Platform) | JetBrains
June 23, 2021 - git checkout 25484aadb20bad868...ContactAdvicedController.java ... 2. In the opened tool window, select the revision you want to revert to, right-click on it, and select "Revert commit"...
๐ŸŒ
Medium
visatch.medium.com โ€บ how-to-recover-all-your-code-when-accidentally-using-git-reset-hard-with-intellij-idea-d11c95ced761
How to recover all your code when accidentally using Git Reset Hard with Intellij Idea | by Visa | Medium
August 3, 2019 - The Local History is in the VSC toolbar of Intellij Idea where you can revert the file from the history of a local machine and this feature saved the history for a few days.
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 205803359-Revert-to-previous-commit
Revert to previous commit? โ€“ IDEs Support (IntelliJ Platform) | JetBrains
Complete newbie question: How do I revert to a version 2 commits earlier?Reverting to a previous version of single files seems pretty predictable, butI'm pretty dumbfounded by changelists, partial ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ git โ€บ how-to-revert-to-last-commit
How to Revert to Last Commit? - Git
June 6, 2024 - 4. Push the changes (if working on a shared repository): ... Reverting to the last commit is a common task in Git that can be achieved using `git reset`, or `git revert`. Each method has its specific use cases:
๐ŸŒ
Graphite
graphite.com โ€บ guides โ€บ git-revert-commit-after-pushing
git revert commit after pushing - Graphite
Simply use git revert on the revert commit hash: ... To revert multiple commits in reverse chronological order (newest first), you can revert them one by one: ... Whether you've made a mistake in your commit or simply want to modify it before ...
๐ŸŒ
Medium
lucaberton.medium.com โ€บ how-to-revert-the-latest-commit-in-git-a-complete-guide-adc12f396388
๐ŸŒ€ How to Revert the Latest Commit in Git: A Complete Guide | by Luca Berton | Medium
October 8, 2025 - If youโ€™ve already pushed the commit to a shared branch (like main or develop), you should not rewrite history. Instead, use the git revert command: ... This creates a new commit that reverses the changes introduced by the last one.
๐ŸŒ
OpenReplay
blog.openreplay.com โ€บ openreplay blog โ€บ undoing git commits after push: safely revert changes on remote repositories
Undoing Git Commits After Push: Safely Revert Changes on Remote Repositories
November 30, 2024 - # Make necessary changes git add . git commit --amend ยท When you need to undo commits that have already been pushed to a remote repository, you should use git revert to create a new commit that undoes the changes.
Top answer
1 of 16
1910

You can revert individual commits with:

git revert <commit_hash>

This will create a new commit which reverts the changes of the commit you specified. Note that it only reverts that specific commit, and not commits that come after that. If you want to revert a range of commits, you can do it like this:

git revert <oldest_commit_hash>..<latest_commit_hash>

It reverts all the commits after <oldest_commit_hash> up to and including <latest_commit_hash>. Some versions of git also revert the <oldest_commit_hash> itself, so double check if that commit gets reverted or not. You can always drop the latest revert commit (which reverts the oldest commit) with g reset --hard HEAD~.

To find out the hash of the commit(s) you can use git log.

Look at the git-revert man page for more information about the git revert command. Also, look at this answer for more information about reverting commits.

Extra note for re-applying reverted commits:

Usually you revert commits because you discovered the commits that you pushed turn out to have an issue. Then you first want to restore the repo to a stable state, before you continue to fix the issue. So then you would first do the git revert, as described before. Then push those revert commits, so the remote is stable. After that you would want to re-apply the reverted commits locally, so your local repo's files are back to the state before the revert. Then you can fix the issue.

To re-apply the reverted commits, you have to revert the revert commits. So what you would do, is to again execute the git revert command, but then with the range of commits of the revert commits. So your new revert commits will revert the previous revert commits. Then your files are back to the state before the first revert. Then you can fix the issue, create a new commit with the fix, and then push all the new commits.

2 of 16
870

A solution that keeps no traces of the "undo".

NOTE: Don't do this if someone already pulled your change (I would use this only on my personal repo.)

Run:

git reset <previous label or sha1>

Note: previous means the commit before the erroneous commit

This will re-checkout all the updates locally (so git status will list all updated files, meaning, the files you changed/added/.. and were committed).

Then you "do your work" and re-commit your changes (Note: This step is optional).

git commit -am "blabla"

At this moment your local tree differs from the remote

git push -f <remote-name> <branch-name>

will force the remote branch to take this push and remove the previous one (specifying remote-name and branch-name is not mandatory but is recommended to avoid updating all branches with update flag).

!! Watch-out some tags may still be pointing removed commit !! how-to-delete-a-remote-tag