You can undo the git add
command before committing in Git by using the git reset
command. The git reset
command allows you to unstage changes that have been staged with the git add
command.
Here’s an example of how to undo the git add
command for a specific file:
$ git reset <file>
And here’s an example of how to undo the git add
command for all files:
$ git reset
After running the above command, the changes you staged with git add
will be unstaged, and you’ll be able to make further changes to the files before committing.