git:我如何递归添加与glob模式匹配的目录子树中的所有文件? [英] git: How do I recursively add all files in a directory subtree that match a glob pattern?
问题描述
在 / xxx / documentation
及其已由Git跟踪的子目录中有几个.screen文件。
I have several .screen files inside /xxx/documentation
and its subdirectories that are already tracked by Git.
在修改了许多这些屏幕文件之后,我运行 git add documentation / \\ * .screen
- 如中的第一个示例所示 -
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
我的命令不行,或者git有bug?
Is my command bad, or does git have a bug?
推荐答案
这是文档中的一个错误。引用星号与
It's a bug in the documentation. Quote the asterisk with
$ git add documentation/\*.screen
或
$ git add 'documentation/*.screen'
您想要的行为。
如果您想要仅在当前目录中添加文件,请使用
If instead you want to add files in the current directory only, use
$ git add *.screen
更新:我提交了 patch 可以解决问题,现在已修复,版本为1.6.6.2。
UPDATE: I submitted a patch that corrects the issue, now fixed as of version 1.6.6.2.
这篇关于git:我如何递归添加与glob模式匹配的目录子树中的所有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!