Free tools Windows power users keep installed
One-click scans. No signup required.
Stop before running a command that might discard work. First inspect the repository with git status, then identify whether the change is in your working tree, the index, or a commit—and whether that commit has already been shared. The safest fix depends on those details; commands such as git reset --hard can erase tracked changes.
Start by finding where the change lives
Git keeps separate records of changes: files in your working tree, staged changes in the index, and commits in branch history. A file can have both staged and unstaged edits at once. Before undoing anything, run:
As an Amazon Associate I earn from qualifying purchases.
git status
To review unstaged edits, use git diff. To review staged edits, use git diff --staged. If you are unsure what a command will replace, inspect the relevant file or commit first. Avoid broad restore or reset commands until you have confirmed their scope.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
- Working tree: edits to files that have not been staged.
- Index: changes staged for the next commit.
- Branch history: commits that have already been created.
Git’s User Manual frames an unwanted commit as a choice between “two fundamentally different ways to fix the problem”: changing history or recording a new commit that reverses the change. Whether the commit is private or already shared is central to that choice.
#1 Best Overall
Undo uncommitted edits in one file
Discard unstaged edits but keep staged changes
After checking git diff -- path/to/file, restore the file from the index:
git restore -- path/to/file
This replaces the file’s working-tree contents with the staged version. Any unstaged edits to that path are discarded.
Unstage a file without discarding its edits
If the file is staged and you want to keep the edits but remove them from the next commit, run:
Recommended Free Tools
git restore --staged -- path/to/file
The changes remain in the working tree. If the file also has unstaged edits, those remain too.
Discard staged and unstaged edits to a file
First inspect both versions with git diff --staged -- path/to/file and git diff -- path/to/file. To replace the working-tree file and index entry with the committed version, run:
git restore --source=HEAD --staged --worktree -- path/to/file
This discards both staged and unstaged changes to that path. The -- separates options from the path, which is useful when a filename could be mistaken for an option.
Rank #2
- Used Book in Good Condition
Restore a file from an earlier commit
To inspect an earlier version without changing your files, show it directly from the commit:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsgit show HEAD^:path/to/file
If that is the version you want, restore it into the working tree and index:
git restore --source=HEAD^ --staged --worktree -- path/to/file
Here, HEAD^ means the parent of the current commit. You can substitute another commit identifier or revision expression. Check the file and source carefully: this replaces that path in both the index and working tree, but does not move the branch or change other files. Commit the result if you want to preserve it in the project’s history.
Restore many files—or the whole tracked tree—with care
To discard unstaged edits in a narrower set of paths, specify those paths with git restore -- path/to/file or a directory. To restore the whole tracked tree and index to the last committed state, the Git User Manual documents:
git restore --staged --worktree :/
This broad command discards staged and unstaged changes to tracked files throughout the repository. It does not remove untracked files. Review git status and inspect any work you may need before using it; prefer explicit paths when only part of the repository should change.
Undo a local commit that has not been shared
If the commit exists only in your local history, git reset moves the current branch to another commit. Its mode determines whether it also changes the index or working tree. For example, to undo the latest commit while keeping its changes staged:
Rank #3
git reset --soft HEAD~1
To undo that commit while keeping its changes in the working tree but unstaged, use the default mixed mode:
git reset --mixed HEAD~1
To move the branch and make the index and working tree match the target commit, reset can use --hard:
git reset --hard HEAD~1
--hard can discard tracked staged and working-tree changes. Do not use it as a first response to an unwanted commit if you need to keep the work. Reset also does not delete untracked files as a general cleanup step.
Undo a commit that is already shared
For a commit others may have fetched or based work on, prefer git revert. It creates a new commit that reverses the selected commit’s changes, instead of moving the shared branch backward:
git revert <commit>
Replace <commit> with the commit identifier you intend to reverse. Inspect the commit first with git show <commit>. If the revert has conflicts, resolve the affected files and stage them, then run git revert --continue. To cancel the in-progress revert, run git revert --abort. Avoid rewriting public history without coordination: other people may already have incorporated the original commit.
Recover a commit after reset, rebase, or branch movement
If a commit seems to have vanished after a reset, rebase, or other movement of a local reference, inspect the reflog:
Rank #4
git reflog
The reflog records recent local positions of references, such as where HEAD pointed. Find the entry from before the mistake, note its commit identifier, and inspect it:
git show <commit>
When you have identified the right commit, create a temporary branch pointing to it so it remains easy to reach while you decide what to do next:
git branch recovery <commit>
Then inspect the recovered history with git log --oneline recovery. A reflog is local to your repository; it is not shared project history, and it may not contain an entry for every situation. Once the commit is safely referenced, you can decide whether to reset your original branch, cherry-pick selected work, or recover files from the commit.
Look for a deleted branch or a commit missing from the reflog
If a deleted branch’s tip is not apparent in the reflog, Git may still have unreferenced objects that have not been pruned. Ask Git to report unreachable objects:
git fsck --no-reflogs --unreachable
For candidate commits, inspect their contents or history with git show <commit> and git log --oneline <commit>. If you find the right commit, give it a branch reference:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11git branch recovery <commit>
This is a possible recovery route, not a guarantee. Git can prune unreachable objects, so the commit may no longer be available. Avoid running cleanup or pruning commands while searching for work you believe is lost.
Best Value
Set work aside or move a commit to another branch
Temporarily set aside uncommitted work
To save current tracked changes and return the working tree and index to the current branch tip, run:
git stash push -m "work in progress"
After switching to the branch where you want the changes, reapply them with:
git stash pop
If the application conflicts, resolve the files and check git status before continuing. Stashing is a way to set aside work, not a substitute for checking what is staged or saved.
Apply a selected commit on the current branch
When the work is already committed and you want that commit’s change on another branch, switch to the destination branch and cherry-pick the commit:
git switch destination-branch
git cherry-pick <commit>
Cherry-pick applies the selected commit as a new commit on the current branch; it does not move the original commit. If a cherry-pick sequence encounters conflicts, Git preserves commits already completed in the sequence and marks the problematic commit. Resolve and stage the conflicts, then run git cherry-pick --continue; to abandon the operation, run git cherry-pick --abort.
Quick Recap
Choose the recovery action by state
| Situation | Safer starting point | What it changes |
|---|---|---|
| Unstaged edits to one file | git restore -- path/to/file |
Replaces the working-tree file with the index version. |
| Staged edits to one file you want to keep | git restore --staged -- path/to/file |
Removes the file’s changes from the index while keeping them in the working tree. |
| Earlier version of one file | git show to inspect, then git restore --source=... --staged --worktree -- path/to/file |
Replaces that path in the index and working tree; does not move the branch. |
| Unwanted local commit; keep changes staged | git reset --soft <target> |
Moves the current branch; leaves the index and working tree unchanged. |
| Unwanted local commit; keep changes unstaged | git reset --mixed <target> |
Moves the branch and resets the index; keeps changes in the working tree. |
| Unwanted commit already shared | git revert <commit> |
Adds a new commit that reverses the selected commit’s changes. |
| Commit lost after local reference movement | git reflog, inspect the candidate, then create a recovery branch |
Finds and anchors a prior local commit if it remains available. |
| Deleted branch or missing reflog entry | git fsck --no-reflogs --unreachable |
May reveal unpruned unreachable objects; recovery is not assured. |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




