For every IDE git related command, once you perform it via UI, you can see the input of the command in the Console log in your git window.

Drop commit does a rebase --interactive --no-autosquash command followed by a hash of a commit made before the commit you are dropping. It interactively rebases your branch on that previous commit and deletes the commit you have selected. This is used to delete the commit entirely and re-write the history.

Undo commit does a soft reset where all the changes of the commit are staged in your changelist.

You can read more about git reset here: https://www.w3schools.com/git/git_reset.asp?remote=github

You can learn more about interactive rebase here: https://www.youtube.com/watch?v=bPX9VHjviEM

Answer from Dino Letic on Stack Overflow
Discussions

Drop commit
Describe the feature that you'd like I'd like to right-click a commit in Git Graph and select a Drop Commit command, which would basically run a rebase, omitting the commit. Additional cont... More on github.com
🌐 github.com
6
September 5, 2019
How to completely remove a commit from git history
Do an interactive rebase and drop the commit in question. More on reddit.com
🌐 r/git
18
6
September 26, 2025
🌐
YouTube
youtube.com › watch
Part 10 | Revert Vs Drop Vs Undo Commit | How to revert a commit | How to drop a commit | - YouTube
Github: https://github.com/amuthansakthivelAd free videos : https://www.testingminibytes.comTelegram group link : Ask your doubts directly to mehttps://t.me/...
Published   March 8, 2023
🌐
GitHub
github.com › mhutchie › vscode-git-graph › issues › 174
Drop commit · Issue #174 · mhutchie/vscode-git-graph
September 5, 2019 - Describe the feature that you'd like I'd like to right-click a commit in Git Graph and select a Drop Commit command, which would basically run a rebase, omitting the commit. Additional context (optional) Sometimes, I work in a feature br...
Author   mhutchie
🌐
JetBrains
jetbrains.com › help › idea › undo-changes.html
Undo changes in Git repository | IntelliJ IDEA Documentation
May 5, 2026 - Unlike reverting a commit, which is reflected in the branch history, you can discard a pushed commit in the current branch without leaving any traces of the operation. Like any operation that rewrites a branch history, dropping a commit requires using force push and cannot be performed in protected branches (these can be configured in the Version Control | Git settings page Ctrl+Alt+S).
🌐
Thinktecture
thinktecture.com › home › rebase onto – when dropping commits makes sense: git in practice – part 3
Rebase Onto - When Dropping Commits Makes Sense: Git In Practice - Part 3 - Thinktecture AG
May 31, 2022 - Either way, our goal would be to only take the commits of our feature branch, in this case, X, Y, and Z, to a new base. When using interactive rebase, to rebase feature onto feature-base, we see something like this: We now have the option to drop commits A, B, and C, by either removing the lines in the editor or changing the command to drop, resulting in applying commits X through Z to where we need them to be.
Find elsewhere
🌐
Alchemists
alchemists.io › articles › git_rebase_drop
Git Rebase Drop | Alchemists
August 15, 2025 - Upon saving the above changes and exiting from the Git Rebase Editor, Git will happily complete your interactive rebase by deleting the first commit and leaving you with only the last commit ("Added calculator implementation"). This is a quick way to remove an unwanted commit. There can be many reasons why you might need to drop a commit, here’s a few:
🌐
Redirect
sethrobertson.github.io › GitFixUm
On undoing, fixing, or removing commits in git
If you see this message, your browser is broken. Please click here
🌐
Today I Learned
til.hashrocket.com › posts › iw7diudcph-dropping-commits-with-git-rebase
Dropping Commits With Git Rebase - Today I Learned
August 11, 2023 - Adding d next to the commits you want to get rid of and saving will drop those commits.
Top answer
1 of 16
5742

Careful: git reset --hard WILL DELETE YOUR WORKING DIRECTORY CHANGES. Be sure to stash any local changes you want to keep before running this command.

Assuming you are sitting on that commit, then this command will wack it...

git reset --hard HEAD~1

The HEAD~1 means the commit before head.

Or, you could look at the output of git log, find the commit id of the commit you want to back up to, and then do this:

git reset --hard <sha1-commit-id>

If you already pushed it, you will need to do a force push to get rid of it...

git push origin HEAD --force

However, if others may have pulled it, then you would be better off starting a new branch. Because when they pull, it will just merge it into their work, and you will get it pushed back up again.

If you already pushed, it may be better to use git revert, to create a "mirror image" commit that will undo the changes. However, both commits will be in the log.


FYI: git reset --hard HEAD is great if you want to get rid of WORK IN PROGRESS.It will reset you back to the most recent commit, and erase all the changes in your working tree and index.

git stash does the same except you can restore it later if you need, versus permanently delete with reset hard mode. Check your stashes by using git stash list and git stash show 'stash@123'


Lastly, if you need to find a commit that you "deleted", it is typically present in git reflog unless you have garbage collected your repository.

2 of 16
969

If you have not yet pushed the commit anywhere, you can use git rebase -i to remove that commit. First, find out how far back that commit is (approximately). Then do:

git rebase -i HEAD~N

The ~N means rebase the last N commits (N must be a number, for example HEAD~10). Then, you can edit the file that Git presents to you to delete the offending commit. On saving that file, Git will then rewrite all the following commits as if the one you deleted didn't exist.

The Git Book has a good section on rebasing with pictures and examples.

Be careful with this though, because if you change something that you have pushed elsewhere, another approach will be needed unless you are planning to do a force push.

🌐
Git Tower
git-tower.com › learn › git faq › how to undo, revert, or delete a git commit
How to Undo, Revert, or Delete a Git Commit | Learn Version Control with Git
Undo the last commit with git reset, revert an older commit with git revert, or remove a commit from history with interactive rebase. All scenarios, step by step.
Published   6 days ago
🌐
GitHub
gist.github.com › justincbeck › 1783723
Drop a commit · GitHub
February 10, 2012 - So he's in a position where he knows where the commits are and he knows that he wants to remove part of 1 or more commits. Originally I thought an interactive rebase would do it. As above: he could interactively rebase, drop the commits he didn't want; by simply removing the lines from the interactive rebase session and then deal with the conflicts the removal of the commits would cause as the rebase continued.
🌐
GitLab
docs.gitlab.com › topics › git › undo
Revert and undo changes | GitLab Docs
# # Commands: # p, pick = use commit ... but discard this commit's log message # x, exec = run command (the rest of the line) using shell # d, drop = remove commit # # These lines can be re-ordered; they are executed from top to bottom....
🌐
Assembla
articles.assembla.com › all collections › using git › advanced controls for git › how to delete commits from a branch in git?
How to delete commits from a branch in Git? | Assembla Help Center
December 20, 2024 - If you don't do this when someone else pulls, it simply merges it into their work, and you will get it pushed back up again. ​ ​If you need to find a commit that you deleted, it is typically present in <git reflog> unless you have garbage collected your repository.
🌐
Git
git-scm.com › book › en › v2 › Git-Tools-Rewriting-History
7.6 Git Tools - Rewriting History
When you save and exit the editor, Git rewinds to the parent of the first commit in your list, applies the first commit (f7f3f6d), applies the second (310154e), and drops you to the console. There, you can do a mixed reset of that commit with git reset HEAD^, which effectively undoes that commit and leaves the modified files unstaged.
🌐
GitKraken
gitkraken.com › home › learn › problems & solutions › how to revert a git commit
Git Revert Commit | Solutions to Git Problems
February 5, 2024 - 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.
🌐
Reddit
reddit.com › r/git › how to completely remove a commit from git history
r/git on Reddit: How to completely remove a commit from git history
September 26, 2025 -

Hello, I have an unusual git repo which I'm using to create backups of a project with quite a few non-source code files, which have changed more than I expected. I'm actually thinking git might not have been the best tool for the job here, but I'm familiar with it and will probably continue to use it. This is just a personal project, and I'm the only contributor.

What I'm looking for is a way to completely erase a git commit, preferably give the git commit hash. The reason for this is because I have several consecutive commits which change a variety of large files, but I really don't care about the commits in between those which I think would be sufficient to keep. I was thinking there should be a way to remove the unneeded intermediate commits with prune, but am not sure what the best approach here is - thanks!

🌐
Graphite
graphite.com › guides › how-to-delete-a-git-commit
How to delete a git commit - Graphite
In the editor, you'll see each commit from the specified range listed on its own line, starting with the word pick. To delete the commit abc1234, simply remove the entire line that contains this commit, or replace pick with drop for the specific commit you wish to remove:
🌐
Alexstrick
alexstrick.com › posts › 2023-04-28-removing-git-commits.html
How to remove a commit (or two) from your git branch – Alex Strick van Linschoten
April 28, 2023 - In the editor that opens, you will see a list of commits starting from the parent commit hash you provided. Find the line with the commit you want to remove. Change the word pick at the beginning of that line to drop or simply delete the entire line. Save and close the editor.