How to cancel git add file

Git110

 description

After using git add, the file has been added to the staging, we can use git reset HEAD to cancel the staging of the specified file

In the demo, we will unstage the file "test.txt"

 command

git reset HEAD test.txt

 parameter

reset :  Reset current HEAD to the specified state

 result

Unstaged changes after reset:
M       test.txt
Was this helpful?

I hope to help every developer quickly find the commands they need. Of course, you can also add your own commonly used commands for easy searching.