Git合并混淆。差异显示差异,合并表示没有差异 [英] Git merge confusion. Diff shows differences, and merge says there are none

查看:240
本文介绍了Git合并混淆。差异显示差异,合并表示没有差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习使用git,并且我遇到了一个我不了解的情况(版本库已经从svn中删除了)。

Im starting to learn to use git, and I am having a situation that I dont understand (the repository was taken out of svn)

code> jacob @ 379 提交了所有内容:

Im on a branch jacob@379 with everything committed:

host$ git status
# On branch jacob@379
nothing to commit (working directory clean)

尝试做一个合并到主:

Try to do a merge to the master:

host:$ git merge master
Already up-to-date.

这是令人困惑的,因为差异表示存在差异!

Which is confusing because the diff says there are differences!

host$ git diff master..jacob@379
warning: refname 'jacob@379' is ambiguous.
diff --git a/.classpath b/.classpath
index 8ba1225..5af1151 100644
--- a/.classpath
+++ b/.classpath
@@ -10,6 +10,11 @@
....

发生了什么事?

推荐答案

可能没有什么新的合并,但你的分支的变化不在master中。这些差异也会反映在提交中,所以你可以做一个简单的检查就是检查日志:

It's possible that there's nothing new to merge but the your branch has changes not in master. Such differences would also be reflected in commits so a simple check you can do is to check the logs:

# See what's in my branch but not master
git log master..jacob@379

# See what's in master but not my branch
git log jacob@379..master

我猜你会在那里看到一些提交。想象一下:

I'm guessing you'll see some commits there. Imagine it this way:


o---o---A---B---C      master
         \       \
          ----D---E---F   jacob@379

在这种情况下,新合并成 jacob @ 379 但这两个分支仍然非常明显不同。

In this case there's nothing new to merge into jacob@379 but the two branches are still quite clearly different.

快速浏览一下 gitk --all 在这里可能会非常有用。

A quick look at gitk --all would probably be really useful here.

这篇关于Git合并混淆。差异显示差异,合并表示没有差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆