When using "git add" with a file template, it recursively adds unverified files and ignores the modified ones if they are not in the current folder.
Example:
$ git status # On branch master # 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: level1/test1.txt # modified: level1/level2/test1.txt # # Untracked files: # (use "git add <file>..." to incldude in what will be committed) # # level1/test2.txt # level1/level2/test2.txt no changes added to commit (use "git add" and/or "git commit -a") $ git add level1\*.txt $ git status # On branch master # Changes to be committed: # new file: level1/level2/test2.txt # new file: level1/test2.txt # # Changed but not updated: # modified: level1/level2/test1.txt # modified: level1/test1.txt #
After executing git add level1\*.txt , files without a trace are added (test2.txt), but not files changed (test1.txt). I tried with the -u option, escaping and didn’t slip away from the asterisk, etc., but nothing seems to just be able to add ALL files matching the pattern, regardless of whether they are tracked or not.
Of course, in this example, I could just add all the files with -A, but keep in mind that this is only for the purpose of this question, in fact there will be more files, and I would not want to add them, and the hierarchy is a few folders deeper. The only way to add monitored files is to write a manual or write the entire template, except for a file name like this: git add level1**.txt OR git add level1/level2/*.txt .
Add documentation to git: it says here that the file template should work recursively and does not say anything about the files being tracked or not, and this even gives an example.
I use msysgit, but I tested this on Windows and Linux just in case.
I just want to know. Am I interpreting the documentation correctly (because I think it should work based on documents), or is that how it should work? It just doesn't make sense to me.
git msysgit
bluediapente
source share