vfclists
vfclists

Reputation: 20231

Is there way to let Git status list to display only directories where files where changes occurred?

Is there way to let Git status list to display only the directories where changes occurred?

git status displays all the files which were modified and new files as well. Is there some way to configure it only lists the directories where changes occurred?

In projects where modules are organized by directories it is useful to now which modules have been changed. It will also be useful if it can be done on directory level as well as the depth, so you can also check which sub directories of some sub modules have changed.

This looks like something that requires passing the git status output through some other unix text utility, but it will be good to know if git has some options in this respect.

Upvotes: 0

Views: 334

Answers (2)

anarcat
anarcat

Reputation: 6197

I believe you may be looking for the --dirstat option:

$ git diff --format=format: --dirstat=0
  35.7% dira/
  64.2% dirb/

Unfortunately, that is not supported by git status, but git diff --dirstat seems like a good substitute. Note that it will not find untracked files however.

Upvotes: 2

Philip Oakley
Philip Oakley

Reputation: 14071

Try using the short format -s and filtering on the 'M' modified flag.

You may also be able to use the git diff --diff-filter=[(A|C|D|M|R|T|U|X|B)…[*]] options depending on you underlying needs (the "XY problem").

Upvotes: 2

Related Questions