I want to setup git to stage only certain files of type. With
git add *
in basic dir, i must stage only the files of type cpp,h,txt,html. How i must do this?
I want to setup git to stage only certain files of type. With
git add *
in basic dir, i must stage only the files of type cpp,h,txt,html. How i must do this?
Just use wildcard *
like this:
git add *.cpp
git add *.h
git add *.txt
git add *.html
*
matches any number of characters, so pattern *.txt
will match ale files with names ending with .txt
.
To make this even easier, you can set your own git alias to add only certain files:
git config --local alias.addHtmlFiles 'add *.html'
git config --local alias.addTextFiles 'add *.txt'
git config --local alias.addCppFiles 'add *.cpp'
git config --local alias.addHeaderFiles 'add *.h'
Now you just use
git addHtmlFiles
git addTextFiles
git addCppFiles
git addHeaderFiles
to add wanted files.