1. Right click on the commit you like to reset to (not the one you like to delete!)
  2. Select "Reset master to this commit"
  3. Select "Soft" reset.

A soft reset will keep your local changes.

Source: https://answers.atlassian.com/questions/153791/how-should-i-remove-push-commit-from-sourcetree

Edit

About git revert: This command creates a new commit which will undo other commits. E.g. if you have a commit which adds a new file, git revert could be used to make a commit which will delete the new file.

About applying a soft reset: Assume you have the commits A to E (A---B---C---D---E) and you like to delete the last commit (E). Then you can do a soft reset to commit D. With a soft reset commit E will be deleted from git but the local changes will be kept. There are more examples in the git reset documentation.

Answer from nightlyop on Stack Overflow
๐ŸŒ
Attosol
attosol.com โ€บ undo-in-git-using-sourcetree
How to Undo in Git using SourceTree
January 17, 2018 - Try Amend last commit again. This time, you will find that the message appropriately changes without creating a split in the tree structure! You can set up your preferences in SourceTree so that it doesn't push automatically.
Discussions

How to clear Sourcetree push status
I have (since I am new to GIT) some files ready to be pushed on the master branch. I however don't want to ever push to the master, does anyone know how I can see what files I have committed but not yet pushed and how to possibly un-commit them, if something like that is possible. More on community.atlassian.com
๐ŸŒ community.atlassian.com
March 4, 2019
git - How do you revert with sourcetree? - Stack Overflow
What is the process to revert back to a previous commit if you are using sourcetree? Please no command line help, I understand how you would achieve the same result there but am specifically lookin... More on stackoverflow.com
๐ŸŒ stackoverflow.com
How to delete commit from GiHub and remove it from SourceTree ?
git checkout HEAD~2 --hard git push --force More on reddit.com
๐ŸŒ r/github
1
1
July 3, 2018
git - Undo merge in sourcetree - Stack Overflow
Developer x is working in online_report, he has accidentally merged his work in develop and pushed it. I want to undo this merge. I clicked on the commit I want to go back to before the merge (highlighted in blue), I then selected "reset current branch to this commit" and then I choose "hard". More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Quora
quora.com โ€บ How-do-I-revert-a-commit-in-SourceTree
How to revert a commit in SourceTree - Quora
Answer (1 of 4): Simply go to Log/History in source tree, select the previous commit of the commit which we you want to undo and right click and do 'Reset current branch to this commit' This will discard your committed changes(which were not pushed). Thank you.
๐ŸŒ
Atlassian Community
community.atlassian.com โ€บ q&a โ€บ sourcetree โ€บ questions โ€บ how to clear sourcetree push status
How to clear Sourcetree push status
March 4, 2019 - You can then select any given commit and using the context menu (if you are on Windows) you can choose to either revert commits or reset your repository to a state before your commit.
๐ŸŒ
CodeGenes
codegenes.net โ€บ blog โ€บ sourcetree-undo-unpushed-commits
How to Undo Unpushed Commits in Sourcetree for Windows: Remove Local Commits Without Trace โ€” codegenes.net
For pushed commits, use git revert instead (but thatโ€™s beyond the scope of this guide). The most straightforward way to remove unpushed commits is to reset your branch to a previous state (e.g., before the unwanted commits were made).
๐ŸŒ
Medium
medium.com โ€บ @iamleoacosta โ€บ how-to-delete-a-commit-from-source-tree-9eb5699f55ac
How to Delete a Commit from Source Tree | by Leo Acosta | Medium
September 6, 2018 - As this was a bit of a head-scratcher for me I decided I would document exactly the steps on how to delete a commit which has been pushedโ€ฆ
Find elsewhere
๐ŸŒ
Blogger
flummox-engineering.blogspot.com โ€บ 2014 โ€บ 10 โ€บ how-to-undo-git-commit-in-sourcetree.html
Flummoxed by IT: How to undo a git commit in SourceTree
October 29, 2014 - If you wish to undo a prior git commit, there are a few ways to go about it. Are you trying to: Undo the exact changes introduced by a gi...
๐ŸŒ
Reddit
reddit.com โ€บ r/github โ€บ how to delete commit from gihub and remove it from sourcetree ?
r/github on Reddit: How to delete commit from GiHub and remove it from SourceTree ?
July 3, 2018 -

I've accidentally committed and pushed the commit from Source tree onto GitHub, turns out the the stuff I pushed belonged to a wrong project.

I'd like it removed from both my GitHub commits and from Source tree, I right clicked my latest commit on SourceTree and clicked reverse commit in the hopes that it would work. However, I've realized that thing related to source tree and github can be quite complex if you don't know the exact way to do it.

SourceTree latest Commit. GitHub last commit.

Any advice would be greatly appreciated.

๐ŸŒ
Themechills
themechills.com โ€บ how-to-delete-a-commit-from-source-tree
How to Delete a Commit from Source Tree โ€“ ThemeChills
As this was a bit of a head-scratcher for me I decided I would document exactly the steps on how to delete a commit which has been pushed to a remote repo.
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 68423071 โ€บ sourcetree-undo-pushed-commit
git - SourceTree: undo pushed commit - Stack Overflow
@matt True, but you must select the option "Enable force push" first in the SourceTree settings: see stackoverflow.com/a/60294426/6309 2021-07-17T19:04:38.953Z+00:00
๐ŸŒ
Atlassian Community
community.atlassian.com โ€บ q&a โ€บ sourcetree โ€บ questions โ€บ how do i undo a sourcetree pull from branch into master
How do I undo a sourcetree pull from branch into master
June 19, 2019 - You can tell git/Sourcetree to reverse the merge commit - to undo the changes introduced from the merge, but creating a new commit - still showing that a merge with master happened.
๐ŸŒ
LinkedIn
linkedin.com โ€บ pulse โ€บ 5-common-git-mistakes-how-resolve-them-using-uzcรกtegui-pescozo
5 Common Git Mistakes: How to Resolve Them Using Sourcetree
April 14, 2023 - In Sourcetree, you can amend the last commit by clicking on the "Commit" button, selecting "Commit Options," and then choosing "Amend Last Commit." This action will populate the editor with the last commit message, allowing you to edit it as needed. After editing, you can push the changes.
๐ŸŒ
Medium
koukia.ca โ€บ how-to-revert-latest-commits-in-git-fd86a1b2944a
How to revert latest commits in GIT? | by Aram Koukia | Koukia
January 13, 2018 - With this command, all the stuff you changed in your latest commit will be uncommitted.
๐ŸŒ
lulitrail
lulitrail.weebly.com โ€บ sourcetree-revert-to-previous-commit.html
Sourcetree revert to previous commit - lulitrail
This results in a new commit that reverses the changes you want to undo. In the Changed Files pane, right-click the file that you want to revert and select Revert Selected Changes from the context menu.
๐ŸŒ
Quora
indianitindustry.quora.com โ€บ How-to-revert-a-commit-in-SourceTree
How to revert a commit in SourceTree - Indian IT Industry - Quora
Answer: You can commit a reverse commit by rightclicking on a commit and selecting Reverse commit . This will effectively create a new commit that negates the changes you made in your selected commit. The commit with the changes you negated will still exist. Plz upvote ๐Ÿ˜Šโ€ฆ
๐ŸŒ
ICS MEDIA
ics.media โ€บ ics media โ€บ front-end engineer โ€บ how to undo commits in sourcetree with amend, reset, revert, and cherry-pick
How to undo commits in Sourcetree with amend, reset, revert, and cherry-pick - ICS MEDIA
3 weeks ago - From the commit history list, right-click the commit you want to apply and select [Cherry-pick]. Sourcetree does not provide an option to choose whether to commit directly, so a dialog appears asking whether it is OK to commit.