I have several .screen files inside /xxx/documentation
and its subdirectories that are already tracked by Git.
After modifying many of these screen files, I run git add documentation/\\*.screen
—as indicated by the first example in git-add
's documentation—to stage these files, but the command fails:
fatal: pathspec 'documentation/\*.screen' did not match any files
Is my command bad, or does git have a bug?
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
So, to recursively add all files or folders and also sub folders to the staging area of git, we can either call “git add -A” or “git add –all”, it will add all files in the project workspace to the staging area, irrespective of location from where this command is executing.
Git Add All Git facilitates us with a unique option of the add command by which we can add all the available files at once. To add all the files from the repository, run the add command with -A option. We can use '. ' Instead of -A option.
It's a bug in the documentation. Quote the asterisk with
$ git add documentation/\*.screen
or
$ git add 'documentation/*.screen'
to get the behavior you want.
If instead you want to add files in the current directory only, use
$ git add *.screen
UPDATE: I submitted a patch that corrects the issue, now fixed as of version 1.6.6.2.
I've tried the accepted answer, but it didn't worked for me.. so here's mine just in case someone wants to get it's job done without spending time in dissecting various aspects that might cause the problem:
find documentation -name "*.screen" | xargs git add -u
//the -u option to git-add adds to index just the files that were previously tracked and modified
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