To commit something on git using git bash on windows I need to do, e.g.:
1.git add *
2.git commit -m "Commit test"
3.git push origin master
In such way I commit all changes. I would like to add only specific files (*.h and *.cpp). The solution is to use:
ad. 1.:
git add *.h
git add *.cpp
But in such way I add only *.h and *.cpp in current folder. The question is how to add files *.h and *.cpp in current folder and subfolders in one command? Something like:
1.git add *.h and *.cpp and_in_subfolders
and then:
2.git commit -m "Commit test"
3.git push origin master
Thanks.
If you use
git add *.h
The shell will expand the wildcard using files in the current folder.
Git can expand wildcards on its own as well, moreover it does that in the way you want (recursively) so you just need to prevent the shell from expanding the wildcard:
git add '*.h'
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