How do you unstage a file in Git?
You added a file with git add by mistake. To remove it from the staging area:
Terminal output
$ git status -s
M a.txt
$ git restore –staged a.txt
$ git status -s
M a.txt
The file stays changed in your folder. The old way, git reset HEAD a.txt, does the same. See Git Restore.
Learn more about the similar topics:
| Tutorials |
|---|
| No Content Found. |
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |