为什么不会“git add *”?添加“git status”的文件。说是未分期? [英] Why won't "git add *" add files that "git status" says are unstaged?
问题描述
当我输入
git add *
它的行为好像没有添加任何文件,但是当我这样做时
git status
它显示未分离的文件。如图所示,我可以通过手动输入名称来对其进行分类,但在相同情况下需要相当长时间。
我的问题是为什么在这种情况下,我可以不只是输入git add *来添加unstaged文件,我该如何解决这个问题?
此图显示我遇到的行为 http://i.imgur.com/YjqZ85P.png
如果您想添加所有文件,不要使用'*'(由shell解释)
git add。
git add -u
会添加更新的文件。 git add -A。
将两者结合在一起。
请参阅 git add。
和 git add -u
?有什么区别?
另外git add -A和git add。之间的区别:
。
表示该命令在当前子目录中运行,而不是整个工作树。
如果您想知道文件是否被忽略: git check-ignore -v - yourFile
。
正如 git add之间的区别是什么*
和 git add。
,如果有的话?:
git add *
将会添加所有 shell扩展结果的路径*
,而git add。
会告诉git添加当前导演y。
git add *
不会添加以开头的路径。
,因为*
的外壳扩展认为这些是隐藏路径。
torek 解释 * $ c $>为什么要这样做?git-add-add-files-that-git-status-says-are-unstaged / 24950133#comment38777711_24950133>在这种特殊情况下,c>'失败:
在这种特殊情况下,
git add *
成为
git add Bootstrap afile bfile ... index.php main.js。 .. zfile
或类似的, <$ c
$ b请勿通过
- $ c> git add * 因致命错误停止
.gitignore
和
Bootstrap i>通过显式路径添加Bootstrap
它不知道哪个服从,所以它什么都不做。
When I type
git add *
it acts as if there were no files added, yet when I do
git status
it shows files that are unstaged. I can stage them by manually typing the name, as shown in the picture, but that takes quite a while in same cases.
My question is why, in this instance, can I not just type "git add *" to add the unstaged files, and how should I resolve this? Thank you in advance.
This image shows the behavior I am encountering http://i.imgur.com/YjqZ85P.png
If you want to add all files, don't use '*' (which is interpreted by the shell)
git add .
git add -u
would add updated files. git add -A .
combines the two.
See "What's the difference between git add .
and git add -u
?"
Also "Difference between "git add -A" and "git add ."":
The .
indicates the command operates in the current subdirectory instead of the entire working tree.
If you want to known if a file is ignored: git check-ignore -v -- yourFile
.
As explained in "What's the difference between git add *
and git add .
, if any?":
git add *
will add all the paths that are the result of the shell expansion of*
whereasgit add .
will tell git to add the current directory.
git add *
won't add paths that begin with a.
as the shell expansion of*
considers these to be "hidden" paths.
torek explains in the comments why '*
' fails in this particular scenario:
in this particular case,
git add *
becomes
git add Bootstrap afile bfile ... index.php main.js ... zfile
or some such, and
git add *
stops with a fatal error because you told it:
- "don't add
Bootstrap
via.gitignore
", and- "do add Bootstrap via explicit path"
It does not know which to obey, so it does nothing at all.
这篇关于为什么不会“git add *”?添加“git status”的文件。说是未分期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!