In git on the command prompt, I would like to simply add *.cpp and *.h files, but ONLY those that are showing up as modified, when I run the command git status.
For example, if, after I run the command git status I get:
Changes not staged for commit:
Untracked files:
Then I want to stage everything, (all the cpps and h files), except for the last two. How do I do that? Thanks
Use git add's -u option in conjunction with whatever other options you want:
-u--updateUpdate the index just where it already has an entry matching
<pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files.
In this case, something like git add -u '*.cpp' '*.h' should do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With