Unstaging of a file in Git
To unstage a file in Git, use the restore command, with the --staged flag followed by the file name. Let's unstage a file:
git restore --staged file.txt
After checking the status, a message will appear in the terminal stating that our file has been modified, but is not indexed:
Changes not staged for commit:
modified: file.txt
Stage the file in your Git repository. Then unstage it.