[英]how to list all the files that will be affected by `git add .`?
Is there a method that I list all files affected by git add.
有没有一种方法可以列出受
git add.
影响的所有文件git add.
? ?
Does the following command solve the problem? 以下命令是否解决了问题?
$ git ls-files -c -d -m -o
Thank you 谢谢
== Update == ==更新==
I have tried the git diff --stat
and found that they are different from what git add .
我尝试过
git diff --stat
,发现它们与git add .
不同git add .
does. 确实。
Here is an example: 这是一个例子:
$ git status -s
D secondB.txt
M shareLineFile.txt
?? fileA.txt
$ git diff --stat
shareLineFile.txt | 1 +
1 file changed, 1 insertion(+)
$ git add . --dry-run
add 'shareLineFile.txt'
add 'fileA.txt'
git diff --stat
is a fine answer, and will tell you the additions and deletions to files and such. git diff --stat
是一个很好的答案,它将告诉你文件的添加和删除等。
However, to answer your original question "list the files affected by git add .
", you can just add the --dry-run
option to see exactly what git add .
但是,要回答原始问题“列出受
git add .
影响的文件git add .
”,您只需添加--dry-run
选项即可确切了解git add .
would do: 会做:
% git add -n .
add 'foo/bar.py'
add 'README.md'
etc.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.