On this page
1. Decide how to undo a commit in GitHub Desktop #
GitHub Desktop gives you four tools, and the right one depends on whether the commit has been pushed and how many commits you want to change. The official documentation lists them side by side.
- Undo restores the changes from the most recent commit to your working directory, so you can edit and commit again. It works only before you push.
- Reset to commit does the same for every commit back to a chosen point. It works up to the most recent commit you have pushed.
- Revert Changes in Commit adds a new commit that reverses an older one, without erasing history. Use it for anything already shared.
- Amend commit rewrites the most recent commit when you only need to fix the message or add a forgotten file.
If the commit is local, keep reading from step 2. If it is already on a shared branch, skip to step 5.
2. Undo the most recent commit before you push #
Open the repository and look at the left sidebar. Make sure you are on the Changes tab, then click Undo at the bottom of the sidebar, next to the commit message. This is the exact instruction from the GitHub documentation.
What you should see: the commit disappears from history, and its files reappear under Changes as uncommitted edits. Your work is not lost. If the Undo button is missing, that is the first sign the commit has already been pushed; go to step 5.
3. Fix the README and commit it again #
Now edit the file the way you meant to the first time. In the example, the README said the site runs on Node 18, and the correct line is Node 20. Open the README, change the version, and save.
Back in GitHub Desktop, the edited file appears under Changes. Write a clear line in the Summary field, then click Commit to main (the label uses your own branch name). The new commit replaces the mistake with the right content and no trace of the wrong command remains in your local history.
4. Undo a run of commits with Reset to commit #
When the error is older than the last commit, click the History tab in the left sidebar. Find the commit you want to keep, right-click it, and choose Reset to commit. GitHub Desktop restores the changes from every later commit to your working directory and moves the branch back to the selected commit.
You can reset to any commit up to the most recent one that has been pushed. Everything after that point becomes uncommitted changes you can review, keep, or discard. If you only want some of those changes, stage and commit the ones you need and discard the rest before you continue.
5. Reverse a commit that is already pushed #
Do not rewrite a shared branch. Instead, open the History tab, right-click the commit you want to reverse, and choose Revert Changes in Commit. GitHub Desktop creates a new commit that undoes that change and leaves the original commit in history, which is safe for anyone who has already pulled the branch.
If you are reverting several commits, work from newest to oldest. Reverting in a different order can produce merge conflicts, as the GitHub documentation notes. After the revert, click Push origin so the fix reaches the remote.
6. Check the branch before you keep going #
Confirm the result before you move on. In the History tab, the commit list should show either the corrected commit alone or the original plus a revert commit. In the Changes tab, only the edits you intended to keep should remain. If the branch looks right, push. If something is off, stop before pushing. Review the working changes and the selected commit with the project maintainer; another history operation can make recovery harder.
Known problems and fixes #
Reset to commit is greyed out. An open GitHub issue reports the option staying disabled even on a branch with local commits. The reporter's workaround is to run git reset <commit> in a terminal, or to squash the later commits and then click Undo. Those are history-changing workarounds. For this guide, first confirm that the chosen target is within the documented local-reset range and update the application. Use a terminal workaround only when you understand the target commit and retained changes.
Undo is missing after a push. This is expected behavior, not a bug. GitHub Desktop will not rewrite history that exists on the remote. Use Revert Changes in Commit instead, which adds a new commit and keeps the shared history intact.
Revert adds a second commit instead of opening your changes for editing. Revert is designed to create a new commit, so it does not leave the changes staged the way Undo does. A GitHub issue describes the usual surprise, with the reporter reaching for git reset --soft HEAD~1 when they want the changes staged. If the commit is still local, click Undo instead. If it is already pushed, keep the revert commit; rewriting a shared branch causes trouble for everyone else.
Revert fails when files are unmerged. A long-standing GitHub issue captures the message "Reverting is not possible because you have unmerged files." Git will not revert while a merge is unresolved. Finish the merge, commit the resolution, then run the revert again.
Troubleshooting #
| Problem | Likely cause | Fix |
|---|---|---|
| Undo button is not visible | The commit was already pushed | Use Revert Changes in Commit on the History tab |
| Reset to commit is greyed out | The chosen commit is older than the last pushed commit, or the app has not fetched | Confirm the target is within the allowed range; update the app and inspect the linked report |
| Revert says unmerged files exist | You are mid-merge with conflicts | Resolve the conflicts, commit the merge, then revert |
| Reset moved too much | You selected a commit further back than intended | Stop before pushing; inspect retained file changes and get help recovering the intended commit |
| Nothing changed after a fetch | The remote was already up to date | Check that you are on the branch you expect in the top bar |
Variations for a different goal #
Amend the last commit message. On the History tab, right-click the most recent commit and choose Amend commit. For an unshared commit, edit the Summary or Description, then click Amend last commit. If an Amend Will Require Force Push warning appears, stop and check whether the commit was already shared.
Undo without losing the file changes. Undo already returns the changes to your working directory, so nothing is deleted. After undoing, review the returned edits before deciding whether to recommit or set them aside.
Undo more than one commit at a time. Use Reset to commit on the older commit rather than clicking Undo repeatedly. The result is the same, but the reset does it in one action and keeps the later changes together in your working directory.
Completion checklist #
- The branch points at the commit you expect.
- The wrong change is gone from history, or a revert commit sits on top of it.
- Your working directory holds only the edits you want to keep.
- The README shows the correct value.
- The fix is pushed if the branch is shared with anyone.
Next steps #
If this was your first history edit, read the wider best free Git GUI clients list, then compare GitHub Desktop and Sourcetree to see which client fits heavier history work. If you need a fully free client with history tools built in, look at Gitnuro. Developers who already live in an editor can handle commits there too, as described in the note on Visual Studio Code.
Featured illustration: Webindexly.




