How do you discard changes from the staging area in Git?
a)
git remove fileb)
git reset HEAD filec)
git revert HEAD filed)
git clean -f fileAnswer:
b)
git reset HEAD fileExplanation:
The git reset HEAD file command removes a file from the staging area without deleting the changes in the working directory. This allows you to unstage the file but keep the changes intact locally.
For example, if you’ve staged file.txt and decide you don’t want to include it in the next commit, you can run git reset HEAD file.txt to remove it from the staging area.
This command is useful for managing the content that will be included in the next commit without losing any changes in the file.