Interview Prep/Git & GitHub/Undoing changes: reset, revert, restore and reflog

How do you undo `git add` for a file?

BeginnerConceptUndoing changes: reset, revert, restore and reflog
Answer

Unstage it with git restore --staged <file> (older equivalent: git reset HEAD <file>). The working tree edits remain.

All Git & GitHub questions Roadmap: Git & GitHub

More on Undoing changes: reset, revert, restore and reflog