2017-08-13 69 views
0

查看日誌時,我經常使用git log --name-only來查看每個提交更改/引入的文件。 git會在每個日誌條目的文件路徑列表上添加。如何列出包含Git中所有更改文件的特定文件的提交?

但是,如果您使用git log --name-only path-to-file您將按照預期方式獲取涉及該文件的提交,但它只會額外列出指定的文件,而不會列出所有已更改文件的完整列表。使它很無用。在git版本2.1.4上看到的行爲。

是否有不同的咒語可用於列表全部當查看特定文件的日誌時,每次提交文件更改?

+0

可能的複製[如何列出提交中的所有文件?](https://stackoverflow.com/questions/424071/how-to-list-all-the-files-in-a-commit) –

+0

我很確定已經有一個覆蓋你的問題的Stack Overflow問題/答案。在發佈之前嘗試搜索它。 –

+0

@TimBiegeleisen在發佈之前,我已經搜索過。據我所知,這不是重複的。您引用的問題是列出特定提交的已更改文件,而不是查看提交日誌時。無論如何,我都仔細研究過這個問題,但沒有發現。 – kcghost

回答

1

我相信,你所要求的git log -p --full-diff,這裏是該命令的DEF:

--full-diff 
    Without this flag, git log -p <path>... shows commits that touch the 
    specified paths, and diffs about the same specified paths. With this, the 
    full diff is shown for commits that touch the specified paths; this means 
    that "<path>…​" limits only commits, and doesn’t limit diff for those commits. 

你可以看到這個web尋找更先進的方法來搜索日誌

+0

謝謝,'git log --full-diff --name-only-path-to-file'導致我正在尋找的行爲。 – kcghost

0
git log --pretty=%H $FILENAME | while read sha1 
do 
    git show --pretty='%nCommit: %h' --name-only $sha1 
done 
相關問題