In general, you can go back to a commit in your history with git reset.


This is not possible with GitHub Desktop. GitHub Desktop is more of a tool to synchronize your repositories and not a full featured GUI client.
But that doesn't mean you have to use the command line, since there are alternatives. You can find a list here. To mention a few (that support git reset):

  • TortoiseGit (Windows)
  • SourceTree (Mac, Windows)

Here is how you do it on command line. Most clients provide this in their UI using the same vocabulary (usually, you are able to select a commit and reset to it via context menu).

You will go back to the previous commit with

git reset HEAD^

or some more commits (for example 3) by

git reset HEAD^3

or to a specific commit by

git reset f7823ab

Have in mind that, by default, the option --mixed is passed to git reset. So, all changes made, since that commit you reset to, will still be there.

To get the original state of the commit that you want to 'revert', you have to pass --hard. For example:

git reset f7823ab --hard
Answer from SevenEleven on Stack Overflow
Discussions

how to go back to a state at a commit?
Copy the git sha of the commit you wanna go back to. Checkout that sha with git checkout. If it’s not too far back you could do a git reset head. Come to think of it you might be able to git restore to just restore everything to that sha. Anyhow after all that you would need to force push to overwrite the branch. Now that I answered your question let me ask the real question. Why not just fix the bug with a new commit? Why undo all the work you have already done? More on reddit.com
🌐 r/github
12
2
January 5, 2024
Revert commit on Website
Select Topic Area Question Body Hello there! I'm beginner on GitHub, and can't resolve one problem - on desktop version i can "Revert changes in commit" in history without problem... More on github.com
🌐 github.com
8
18
Unity + GitHub Desktop: Tried to Revert to an Earlier Commit and Now Project Is Blank
You need to ensure that you don't put unity generated or mono generated files in your repo. Look up ..gitignore for unity. That may be your issue. More on reddit.com
🌐 r/github
8
2
March 21, 2020
Revert a commit using the online version of Github?
As far as I know, it is only possible in Git Bash/Cmd. More on reddit.com
🌐 r/github
9
7
March 14, 2019
🌐
GitHub
docs.github.com › en › desktop › managing-commits › undoing-a-commit-in-github-desktop
Undoing a commit in GitHub Desktop - GitHub Docs
You can undo multiple sequential commits up to a commit that has already been pushed to the remote repository by selecting a previous commit and using the "reset to commit" option. For more information, see Resetting to a commit in GitHub Desktop. To undo a pushed commit without disrupting commit history for other contributors, you can revert the commit.
🌐
Reddit
reddit.com › r/github › how to go back to a state at a commit?
r/github on Reddit: how to go back to a state at a commit?
January 5, 2024 -

I have GitHub Desktop and I have been making regular commits. Now a bug was introduced and I want to go back and get the whole project as it was in time at a previous commit.

How to do that is not entirely intuitive. How do you go back to a previous state of the entire project at the point of a single commit?

There are no local changes according to Github Desktop....

no changes

The commit that I want to go back to is the 3rd commit down on the left. I figure that (according to their instructions) I would revert the two latest commits and I'd be back where I want to be.

a simple plan

But Github protets and claims there are changes.....

only there aren't any changes

But, there aren't any changes.

WTF Github?

I'm not worried about the code......

I'm just irritated that a versioning system so widely used would be so poorly designed.

Top answer
1 of 3
4
Copy the git sha of the commit you wanna go back to. Checkout that sha with git checkout. If it’s not too far back you could do a git reset head. Come to think of it you might be able to git restore to just restore everything to that sha. Anyhow after all that you would need to force push to overwrite the branch. Now that I answered your question let me ask the real question. Why not just fix the bug with a new commit? Why undo all the work you have already done?
2 of 3
1
Sounds like you were just confused with terminology, which is entirely understandable. Git involves a lot of words that mean very specific things within the context of Git, but are more flexible in ordinary language. In this case, you thought "revert" would do what you wanted, but what that actually means is to permanently revert something going forward. You use it when you decide that some changes you made before are inappropriate and should be undone (and they were in a shared branch that you want to keep using, so you can't merely ignore the last few commits; you need the reversion to explicitly exist in history). What you really want is to "check out" an old commit. Think of it like checking out a book at your local library. You want to read it for a while, and then return to what you were doing before. This is a read-only operation in terms of version history; you're not modifying history by adding a new event to it the way that revision does. You're only browsing through history, observing what it looked like at various moments by modifying only your local working copy.
🌐
GitHub
github.com › orgs › community › discussions › 60023
Revert commit on Website · community · Discussion #60023
Hey. If you don't want to revert a commit using the console, the easiest way is to go to Github Desktop (which is UI-based rather than terminal), set current repo to the specific repo, click on history, and right click on a commit.
🌐
GitHub
docs.github.com › en › desktop › managing-commits › options-for-managing-commits-in-github-desktop
Options for managing commits in GitHub Desktop - GitHub Docs
Often, it is difficult to follow these best practices perfectly at the point where you're making changes. You might realize you need to undo the changes in a commit you've made, edit a commit message, or reorder your commits to tell a clearer story. With GitHub Desktop, you can manage your commit history directly from the user interface.
Find elsewhere
🌐
GitHub
docs.github.com › en › desktop › managing-commits
Managing commits - GitHub Docs
You can use GitHub Desktop to amend, cherry-pick, reorder, revert, reset, and squash commits.
🌐
GitHub
docs.github.com › en › enterprise-server@3.10 › desktop › managing-commits › checking-out-a-commit-in-github-desktop
Checking out a commit in GitHub Desktop - GitHub Enterprise Server 3.10 Docs
You can recover commits that have been made in a "detached HEAD" state using the git reflog command from the Git command line. You can open your repository in the command line from GitHub Desktop by going to the menu bar, selecting Repository, ...
🌐
GitHub
github.com › github › docs › blob › main › content › desktop › managing-commits › reverting-a-commit-in-github-desktop.md
docs/content/desktop/managing-commits/reverting-a-commit-in-github-desktop.md at main · github/docs
Reverting a commit in GitHub Desktop · shortTitle · Reverting a commit · intro · You can use {% data variables.product.prodname_desktop %} to revert a specific commit to remove its changes from your branch. redirect_from · /desktop/contributing-to-projects/reverting-a-commit ·
Author   github
🌐
YouTube
youtube.com › watch
Revert a single file to the status at a particular commit.
Enjoy the videos and music you love, upload original content, and share it all with friends, family, and the world on YouTube.
🌐
YouTube
youtube.com › exploi.t.
Revert Commits & Merge Conflicts | GitHub Desktop - YouTube
In this video, we'll learn how to Revert Commits, solve Merge Conflicts and delete repositories using the GitHub Desktop easily and how it works in a better ...
Published   September 20, 2020
Views   20K
🌐
iorad
iorad.com › player › 2119061 › GitHub---How-to-stop-receiving-dialog-to-undo-commit-on-GitHub-desktop-
GitHub - How to stop receiving dialog to undo commit on GitHub desktop.
Here is how to do it. Open up GitHub Desktop.. Click File.. Click Options.. Click Prompts.. Click Undo commit.. Click Save.. That's it. You're done.
🌐
Quick Adviser
quick-adviser.com › how-do-i-undo-a-commit-on-github-desktop
Loading...
November 22, 2019 - We cannot provide a description for this page right now
🌐
Medium
medium.com › @pavolkutaj › revert-changes-in-the-commit-with-github-desktop-e08854c27b8
Revert Changes in the Commit with GitHub Desktop - Pavol Z. Kutaj - Medium
January 29, 2021 - The concern is documenting the GUI approach to a simple revert of a commit. I could not come up with an elegant git CLI solution, the easiest is to use the GUI of GitHub Desktop
🌐
Rewind Backups
backhub.co › home › blog › data recovery
Recovering Deleted Files in GitHub
August 30, 2024 - This will revert the offending commit and create a new commit. This method is comparatively easier than using the command line and a better choice if you’re comfortable with graphical interfaces. However, it has the following disadvantages: The desktop app is only available for Windows and macOS.
🌐
Adoclib
adoclib.com › blog › github-desktop-revert-commit-results-in-head-even-in-a-new-cloned-repository.html
ADocLib .NET SDKs for PDF, Excel, Word, OCR, Barcodes | Web, WinForms & WPF Development
Contact the Domain Owner: webmaster@adoclib.com provides high-performance .NET PDF SDK, .NET Word SDK, .NET Excel SDK, .NET OCR SDK, and .NET Barcodes SDK for Barcodes Generation & Recognition; free trials for evaluation; code samples for C# and VB.NET programmings.