Reputation: 81500
I want to display the filenames in git log --stat
relative to a certain sub-folder, so that it's easier to read. How can I do this?
I tried git log --stat sub/folder/foo
, git log --stat sub/folder/foo/
, and changing to the subfolder before running git log --stat
, git log --stat .
, and git log --stat ./
.
Upvotes: 1
Views: 367
Reputation: 81500
Use --relative
:
--relative[=<path>]
When run from a subdirectory of the project, it can be told to exclude changes outside the directory and show pathnames relative to it with this option. When you are not in a subdirectory (e.g. in a bare repository), you can name which subdirectory to make the output relative to by giving a
<path>
as an argument.
Upvotes: 3
Reputation: 11313
You can issue the command git whatchanged --relative
to give exactly which you want.
It will list like something like this for the spec
folder, for example:
commit 0e1efda06b940d0b675a45884bc379bfb77537eb
Author: Andrew Grimm <[email protected]>
Date: Fri Apr 24 23:42:44 2015 +1000
Fix broken spec fixtures
:100644 100644 f6d6ef0... 2ae6d82... M spec/factories/pmc_article_factory.rb
:100644 100644 bc30bfb... ecb98c9... M spec/factories/pmc_article_list_factory.rb
commit fe77bd9fac39f6abcd4e19fac39d69cb64582f7e
Author: Andrew Grimm <[email protected]>
Date: Fri Apr 10 19:31:25 2015 +1000
Squash all commits for the repo, because of wrong email being used.
:000000 100644 0000000... 4bb2e7c... A spec/affiliation_words_query_spec.rb
:000000 100644 0000000... f6d6ef0... A spec/factories/pmc_article_factory.rb
:000000 100644 0000000... bc30bfb... A spec/factories/pmc_article_list_factory.rb
:000000 100644 0000000... d23c1d9... A spec/frequent_names_runner_spec.rb
:000000 100644 0000000... 5e48c86... A spec/pmc_article_spec.rb
:000000 100644 0000000... b598abe... A spec/spec_helper.rb
:000000 100644 0000000... eec437f... A spec/support/factory_girl.rb
Upvotes: 2