2015-08-28 81 views
1

我想在git log --stat中顯示相對於某個子文件夾的文件名,以便讀取更容易。我怎樣才能做到這一點?git log --stat相對於子文件夾

我試過git log --stat sub/folder/foogit log --stat sub/folder/foo/和運行git log --statgit log --stat .,並且git log --stat ./之前,改變到子文件夾。

回答

2

使用--relative

--relative [= <路徑>]

如果是從項目的子目錄中運行,它可以告訴排除相對 目錄和秀路徑名之外的變化使用此選項。如果您不在子目錄中(例如,在 裸存儲庫中),那麼您可以通過給出一個作爲參數來命名使輸出相對於哪個子目錄的名稱。

2

你可以發出命令git whatchanged --relative來給出你想要的。

它會列出像這樣的事情在spec文件夾,例如:

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 
+0

什麼是與每個文件相關聯的兩個十六進制值? –

+0

我的意思是'f6d6ef0 ... 2ae6d82 ...'位。 –

+1

這些應該是這些斑點的相關SHA。 – vgoff