在提交之间显示差异

在提交之间显示差异

本文介绍了在提交之间显示差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在上使用Git(Lucid Lynx)。



我向主人做了一些提交。

然而,我想获得差异在这些提交之间。所有这些都在我的主分支上。



例如:

 提交dj374 
进行更改
$ b $提交y4746
进行更改

提交k73ud
进行更改

我想要了解k73ud和dj374的区别。但是,当我做了以下操作时,我无法看到我在 k73ud 中所做的更改。

  git diff k73ud..dj374> master.patch 


解决方案

b

  git diff k73ud ^ .. dj374 

确保在结果差异中包含 k73ud 的所有更改。

比较两个端点()。
由于OP希望看到由 k73ud 引入的更改,他/她需要区分(或 k73ud ^ 1 或 k73ud〜 diff 结果将包含自 开始的更改 k73ud 父级(意指包括 k73ud 本身的变化),而不是自 code> k73ud (高达 dj374 )。


I am using Git on Ubuntu 10.04 (Lucid Lynx).

I have made some commits to my master.

However, I want to get the difference between these commits. All of them are on my master branch.

For example:

commit dj374
made changes

commit y4746
made changes

commit k73ud
made changes

I want to get the difference between k73ud and dj374. However, when I did the following I couldn't see the changes I made in k73ud.

git diff k73ud..dj374 > master.patch
解决方案

Try

git diff k73ud^..dj374

to make sure to include all changes of k73ud in the resulting diff.

git diff compares two endpoints (instead of a commit range).Since the OP want to see the changes introduced by k73ud, he/she needs to difference between the first parent commit of k73ud: k73ud^ (or k73ud^1 or k73ud~).

That way, the diff results will include changes since k73ud parent (meaning including changes from k73ud itself), instead of changes introduced since k73ud (up to dj374).

这篇关于在提交之间显示差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 03:41