How to list all files that `git add.` will affect?

Is there a method in which I list all the affected files git add.?

Does the following command solve the problem?

$ git ls-files -c -d -m -o

thanks

== Update ==

I tried git diff --statand found that they are different from what they do git add ..

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'
+4
source share
2 answers

git diff --stat is a great answer and will tell you about additions and deletions of files, etc.

However, in order to answer your original question “list files that are affected git add .”, you can simply add a parameter --dry-runto see what it will do git add .:

% git add -n .
add 'foo/bar.py'
add 'README.md'
etc.
+2
source
git diff --stat

, + , git add ..

enter image description here


git diff

enter image description here

+3

Source: https://habr.com/ru/post/1624438/


All Articles