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 OverflowIn 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
If you have a commit that you have not pushed, it is easy to undo the commit. The "undo" button appears when you have such a commit. It removes the commit from the branch's history and places the files back into the Changes area.

How to revert to a previous commit?
Revert commit on Website
Resetting HEAD To a Previous Commit in Time
how to go back to a state at a commit?
Videos
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 changesThe 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.
The safest and probably cleanest way to go is to rebase interactively.
git rebase -i HEAD^^
Or,
git rebase -i baf8d5e7da9e41fcd37d63ae9483ee0b10bfac8e^
From there you can squash commits, which puts one or more commits together into the previous commit. To completely delete a commit from the history, delete the line from the list.
You can revert a commit with git revert but its going to add more commit messages to the history, which may be undesirable. Use the -n parameter to tell Git not to commit the revert right away. You can rebase interactively and squash those on up to a previous commmit to keep things clean.
If the two commits you're working with here affect the same file(s), you may see a merge conflict.
Resetting the repository with git reset --hard should be done with care, as it cannot be undone.
Rewriting history should be done with care.
This if from http://nakkaya.com/2009/09/24/git-delete-last-commit/ and it worked for me
Git Delete Last Commit
Once in a while late at night when I ran out of coffee, I commit stuff that I shouldn't have. Then I spend the next 10 - 15 minutes googling how to remove the last commit I made. So after third time I wanted to make a record of it so I can refer to it later.
If you have committed junk but not pushed,
git reset --hard HEAD~1HEAD~1 is a shorthand for the commit before head. Alternatively you can refer to the SHA-1 of the hash you want to reset to. Note that when using --hard any changes to tracked files in the working tree since the commit before head are lost.
If you don't want to wipe out the work you have done, you can use
--softoption that will delete the commit but it will leave all your changed files "Changes to be committed", as git status would put it.Now if you already pushed and someone pulled which is usually my case, you can't use git reset. You can however do a git revert,
git revert HEADThis will create a new commit that reverses everything introduced by the accidental commit.