Git · Junior · Question 29 of 75
How do you unstage a file but keep its changes?
- 1
git restore --worktree file.js - ✓Correct answer:
git restore --staged file.js - 3
git rm --force file.js
Explanation
--staged resets the index entry to the last commit, while the working copy stays as is. git reset file.js does the same.