I accidentally added many files (test files) which I do not want them to be part of commit.
I want to reset the branch back to the head, but I already have few files which I have modified, and which I want them to be part of next commit.
Files that I want to commit and files that I do not want to commit are located in separate folder.
Is there anyway that I can discard newly added files, and keep the modified files with git command?
Below is the status that I got.
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: Makefile
# //and 100 of other files in current directory
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: ../program.C
# modified: ../program.h
# //and few more files..
git reset <directory>will recursively unstage any files in that directory. Alternately, justgit resetto unstage everything, andgit add <files>to add back just what you want.