开发者

Any way to get git diff with commit changes in single command

Is there any way we can get the details of diff of a file along with it's commit ID details through a single command ? Currently , "git diff tag1..tag2" gives me the entire code change be开发者_运维知识库tween the two tags but not the commit ID and reasons for commit . When i use " git log " it gives me complete commit change with changes that i'm not concerned with when comparing two tags .


but this change also has a commit ID and commit reason which i want in the same diff file

I think there is a little confusion here. The git-diff outputs the difference between one commit and another, that difference is not just one commit, it represents a series of commits in the range you specify (662a1fa..64f9766 in the example you gave). So that would be multiple commit IDs and messages, perhaps even thousands if your tags are far enough apart.

If git diff were to output all the associated commit messages you would have no good way of telling which part of the diff is associated with each commit ID and commit message. This is why git log exists.

Git log does display each commit one after another in the range you specify and so that's why it will display commit messages.

git-diff shows you the difference between a and z.
git-log shows you the journey a took to become z.

With that in mind, I'm guessing this is probably what you are looking for:

git log --color -p --full-diff tag1..tag2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜