Junior
What does the command 'git unstage' do?
sobes.tech AI
Answer from AI
Reverts the addition of changes to the index (staging area). In other words, it moves files from the "staged" state back to the "modified" state without affecting the working directory.
It is used when you accidentally added a file with git add, but decide not to include it in the next commit.
Syntax:
# Move all staged changes out of the index
git restore --staged .
# Move a specific file out of the index
git restore --staged <file(s)>
# Old syntax (less clear)
git reset HEAD <file(s)>