Unstage files without losing changes

Low risk
What do risk levels mean?
Read-only
Inspects state without changing anything.
Low risk
Reversible with a routine follow-up command.
Medium risk
Changes state; undo path documented.
Destructive
Deletes or overwrites; confirmation required.

Removes files from the staging area so they will not be part of the next commit, while leaving the changes intact in the working tree.

gitstagingunstage

Parameters

File or directory to unstage; defaults to everything.

Commands

Review what is currently staged

git status --short

Remove the selected paths from the staging area

git restore --staged .

Verification

git status --short

The files show as modified but unstaged; their content is unchanged.

Undo

Stage the same paths again

git add .

Pitfalls

  • Only staging is affected; nothing in the working tree is modified or lost.
  • For a newly added file, unstaging makes it untracked again but keeps it on disk.

Related