user151841
user151841

Reputation: 18046

git diff show just directories, not all new files

If I have a repository where I add new subdirectories and make changes to files, when I run git status, I see a summary

$ git status
On branch test
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   composer.json
        modified:   composer.lock
        modified:   vendor/composer/autoload_psr4.php
        modified:   vendor/composer/autoload_static.php
        modified:   vendor/composer/installed.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        modules/contrib/a11y_paragraphs_tabs/
        vendor/jakubsuchy/

no changes added to commit (use "git add" and/or "git commit -a")

When I add and commit those files, and then do git diff --stat master, it shows me all the the file names, including those in the new directories:

$ git diff --stat master
 composer.json                                                                                             |   5 +-
 composer.lock                                                                                             | 207 ++++++++++++++++++++++++++++++++-
 modules/contrib/a11y_paragraphs_tabs/LICENSE.txt                                                          | 339 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 modules/contrib/a11y_paragraphs_tabs/README.md                                                            |  88 ++++++++++++++
 modules/contrib/a11y_paragraphs_tabs/a11y_paragraphs_tabs.info.yml                                        |  14 +++
 modules/contrib/a11y_paragraphs_tabs/a11y_paragraphs_tabs.install                                         |  33 ++++++
 modules/contrib/a11y_paragraphs_tabs/a11y_paragraphs_tabs.libraries.yml                                   |  17 +++
 modules/contrib/a11y_paragraphs_tabs/a11y_paragraphs_tabs.module                                          |  46 ++++++++
 .../config/optional/core.entity_form_display.paragraph.a11y_paragraphs_tab_content.default.yml            |  25 ++++
 .../config/optional/core.entity_form_display.paragraph.a11y_paragraphs_tabs_panel.default.yml             |  39 +++++++
 .../config/optional/core.entity_form_display.paragraph.a11y_paragraphs_tabs_wrapper.default.yml           |  39 +++++++
 .../config/optional/core.entity_view_display.paragraph.a11y_paragraphs_tab_content.default.yml            |  21 ++++
 .../config/optional/core.entity_view_display.paragraph.a11y_paragraphs_tabs_panel.default.yml             |  32 ++++++
 .../config/optional/core.entity_view_display.paragraph.a11y_paragraphs_tabs_wrapper.default.yml           |  32 ++++++
 .../config/optional/field.field.paragraph.a11y_paragraphs_tab_content.field_a11y_para_tabs_text_area.yml  |  20 ++++
 .../config/optional/field.field.paragraph.a11y_paragraphs_tabs_panel.field_a11y_para_tabs_tab_content.yml |  36 ++++++
 .../config/optional/field.field.paragraph.a11y_paragraphs_tabs_panel.field_a11y_para_tabs_tab_title.yml   |  20 ++++
 .../config/optional/field.field.paragraph.a11y_paragraphs_tabs_wrapper.field_a11y_para_tabs_sec_title.yml |  20 ++++
 .../optional/field.field.paragraph.a11y_paragraphs_tabs_wrapper.field_a11y_para_tabs_tabs_panel.yml       |  33 ++++++
 .../a11y_paragraphs_tabs/config/optional/field.storage.paragraph.field_a11y_para_tabs_sec_title.yml       |  19 +++
 .../a11y_paragraphs_tabs/config/optional/field.storage.paragraph.field_a11y_para_tabs_tab_content.yml     |  19 +++
 .../a11y_paragraphs_tabs/config/optional/field.storage.paragraph.field_a11y_para_tabs_tab_title.yml       |  19 +++
 .../a11y_paragraphs_tabs/config/optional/field.storage.paragraph.field_a11y_para_tabs_tabs_panel.yml      |  19 +++
 .../a11y_paragraphs_tabs/config/optional/field.storage.paragraph.field_a11y_para_tabs_text_area.yml       |  18 +++
 .../a11y_paragraphs_tabs/config/optional/paragraphs.paragraphs_type.a11y_paragraphs_tab_content.yml       |   8 ++
 .../a11y_paragraphs_tabs/config/optional/paragraphs.paragraphs_type.a11y_paragraphs_tabs_panel.yml        |   8 ++
 .../a11y_paragraphs_tabs/config/optional/paragraphs.paragraphs_type.a11y_paragraphs_tabs_wrapper.yml      |   8 ++
 modules/contrib/a11y_paragraphs_tabs/css/a11y-paragraphs-tabs.css                                         | 162 ++++++++++++++++++++++++++
 modules/contrib/a11y_paragraphs_tabs/js/a11y-paragraphs-tabs.js                                           |   6 +
 modules/contrib/a11y_paragraphs_tabs/templates/field--field-a11y-para-tabs-tabs-panel.html.twig           |   3 +
 modules/contrib/a11y_paragraphs_tabs/templates/paragraph--a11y-paragraphs-tabs-wrapper.html.twig          | 131 +++++++++++++++++++++

mules/contrib/nasa | 1 + vendor/composer/autoload_psr4.php | 1 + vendor/composer/autoload_static.php | 5 + vendor/composer/installed.json | 195 +++++++++++++++++++++++++++++++

 37 files changed, 1683 insertions(+), 7 deletions(-)

Is there any way to do a diff --stat against another branch that looks just like the output of git status? In other words, I would want to see this:

$ git diff --stat --summary? master
 composer.json                                         |   5 +-
 composer.lock                                         | 207 ++++++++++++++++++++++++++++++++-
 modules/contrib/a11y_paragraphs_tabs/                 |   some other stat here indicating files
 vendor/composer/autoload_psr4.php                     |   1 +
 vendor/composer/autoload_static.php                   |   5 +
 vendor/composer/installed.json                        | 195 +++++++++++++++++++++++++++++++
 37 files changed, 1683 insertions(+), 7 deletions(-)

That, if the other branch doesn't contain the directory, just list the directory, and not all it files and subdirectories.

Upvotes: 4

Views: 234

Answers (1)

VonC
VonC

Reputation: 1324258

You might have to combine:

  • git diff --stat --summary . (note the <space dot>) for the current folder
  • git diff --dirstat for the other folders

I have not seen a way to combine both in one command.

Upvotes: 3

Related Questions