How can I unstage my files again after making a local commit?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
After a local commit, there is no staging area left for those changes because the snapshot is already recorded in history. So when people say "unstage after commit", they usually mean "move the last commit back into the index or working tree so I can recommit it differently".
Decide Where You Want the Changes to Go
Git gives you a few choices depending on the state you want after undoing the commit:
- keep changes staged
- keep changes but unstage them
- discard the changes entirely
For a local commit that has not been pushed, the most common commands are git reset --soft and git reset --mixed.
Keep the Changes Staged
If you want to undo the last commit but leave all of its changes staged, use:
This moves HEAD back one commit but keeps the index intact. It is useful when the commit message was wrong or when you want to recommit immediately after a small adjustment.
You can confirm the state with:
The files will appear as staged changes ready for a new commit.
Keep the Changes but Unstage Them
If your real goal is to get the files back into the working tree and out of the staging area, use the default mixed reset:
This removes the last commit and leaves the file modifications in your working tree as unstaged changes.
That is usually the closest answer to "unstage my files after committing". You now have the edits locally, but nothing is staged or committed.
Adjust Only Some Files
Suppose the last commit contained several files, but you want to recommit only part of it. A common workflow is:
If you accidentally stage too much during that process, use:
That command unstages a file while keeping its content changes in the working tree.
Amend When the Commit Mostly Stays the Same
If the last commit is almost right and you only need to add or remove a small change, you may not need to reset it fully. Instead:
That pattern is useful only if the file is still staged before the amended commit. Once the commit is already finalized and nothing is staged, a reset is the clearer first step.
Be Careful if the Commit Was Pushed
Everything above is safest for local-only history. If the commit has already been pushed to a shared remote, rewriting it changes published history. That does not mean you can never do it, but it means you should pause and decide whether your team allows force-push workflows.
If the commit is already public, creating a new corrective commit is often safer than rewriting history.
A Concrete Example
Imagine you just ran:
Then you realize the commit included debug files. To pull everything back out:
The important moment is the reset. That is what moves the committed snapshot back into an editable state.
Common Pitfalls
- Thinking
git restore --stagedcan directly unstage content that is only in a past commit. First you need to move the commit back withgit reset. - Using
git reset --hardwhen you wanted to keep your edits.--harddiscards working tree changes. - Rewriting history after pushing without checking whether a force push is acceptable.
- Confusing staged changes with committed history. They are different Git states.
- Resetting too far back, such as
HEAD~2, when only the last commit needed adjustment.
Summary
- After a commit, "unstage" usually means moving the commit back into the index or working tree.
- Use
git reset --soft HEAD~1to undo the commit and keep changes staged. - Use
git reset HEAD~1to undo the commit and keep changes unstaged. - Use
git restore --stagedafter the reset when you need finer control over which files stay staged. - If the commit was already pushed, prefer a corrective commit unless history rewriting is intentional and safe.

