How to remove a file (git undo add) from staging ready for the next commit?
Once software development is done and now you are ready to make a commit. For that, list the changed files, maybe there are new files too. Next is to add source files for a commit.
But just before commit, you noticed that there are one or more files that are not needed or you have added accidentally. The reasons can be any. But you need to remove the undesired files or undo staging for the next commit. How to do that with an already executed git add command?
The reversing is called git undo add or git unadd. For undo, there is a
git reset command. The git reset can be used to undo an added file or to undo all staged files.
Git Reset command example for undo a git add?
- #git reset <filename> (to undo a add for a file)
- #git reset ( for all files)