Git add all .tex files recursively
Cloning a completely fresh repo.
I now have a complex file structure with many different files copied to my local working directory. But now I just want to add only all .tex files to all subfolders. But the following doesn't work:
git add *.tex #error-message: fatal: pathspec '*.tex' did not match any files
git add /*tex #error-message: fatal: C:/Program Files (x86)/Git/*.tex: 'C:/Program Files(x86)/Git/*.tex' is outside repository
Working with git version 1.8.5.2.msysgit.0 on a Windows machine.
How to do it?
Update
git add **/*.tex
works good.
Another approach: How can the .gitignore file be adjusted so that it ignores everything except .tex files? I tried the following in my .gitignore file and then did git add .
, but it didn't work.
#Ignore all files
*
#except
!**/*.tex
Second update
Got working with the following .gitignore file:
#Ignore all files
*
#except
!*/
!.gitignore
!*.tex
+3
source to share