我在显示存储库的日志/历史记录的所有git命令时遇到问题。此问题仅限于我的某个存储库。我还有其他几个工作得很好。
对于有问题的repo,我只看到提交的摘要,其中默认行为是显示diff。
$ git show
commit bc8865f8b16ccf9eerrt678df99a4b89e73c0545
Merge: 677f483 3e8617d
Author: Some Author
Date: Thu Jul 23 07:56:28 2015 -0400
Merge branch 'Some_branch' ....
类似地, git diff-tree 命令适用于除此之外的所有repos。
正常回购:
git diff-tree --pretty=format:%an %cn 5cff917e
Joe Black Joe Black
:040000 040000 98c97ee8929b487ae14ada67c1932205a80cfc3f 719f1764f123d462b20707f5f7740e4f473b2b47 M oracle
回答问题:
$ git diff-tree --pretty=format:%an 39ebdeb8f29
jblack@DFX1 ~/repositories/RepoName(master)
答案 0 :(得分:4)
You are running git show
on a merge commit:
Merge: 677f483 3e8617d
There is no unique way to show the diff for a merge commit: this commit has two parents, you can diff with either of them. To show the diff with each parent, use
git show -m <commit>
答案 1 :(得分:3)
From the git show
docs:
For commits it shows the log message and textual diff. It also presents the merge commit in a special format as produced by git diff-tree --cc.
and from the git diff-tree
docs:
--cc
This flag changes the way a merge commit patch is displayed, in a similar way to the -c option. It implies the -c and -p options and further compresses the patch output by omitting uninteresting hunks whose the contents in the parents have only two variants and the merge result picks one of them without modification. When all hunks are uninteresting, the commit itself and the commit log message is not shown, just like in any other "empty diff" case.
So for merges, show by default won't bother you with changes that automerge handled silently for you. As Matthieu Moy points out, to see all the changes regardless, feed it -m
.