分支显然是分歧的,但提交历史是相同的 [英] Branches have apparently diverged, but commit history is identical

查看:116
本文介绍了分支显然是分歧的,但提交历史是相同的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



<$ p $ p> #在分支master上
#你的分支和'origin / master'分别有
#和13个不同的提交。

但每个的提交历史都是相同的。也就是说, git log 以相同的顺序显示相同的提交,具有相同的SHA-1哈希。这是最后13次提交,以及之前的所有内容。



发生了什么?或者我误解了一些基本的东西 - git对我来说都是新鲜的。



我如何陷入混乱 - git-svn,cygwin,EGit,pull - - 与虚假冲突相关 - 但我想知道这种分歧没有任何差异是否有可能是由于换行?我已经在记事本中打开了文件,并且读了很多关于svn / git / cygwin和CRLF的内容,但没有任何启示。


$ b

编辑确定。以上大部分并不是真正的问题。也许我不明白 git log 或其他东西已经搞乱了...



我有两个存储库。如果我去rep_A并运行 git log ,我会得到相同的结果(特别是与SHA-1相同),就像我转到rep_B并运行 git log



在rep_A上,如果我运行 git log origin / master 我期望的不同提交历史。 (不同的SHA-1,但是相同的消息 - 我如何创建这个混乱是另一回事。)

git remote -v show $ b $ p $ git log ,在rep_B上,不符合我的预期。就像它给了我rep_A的提交历史。我错过了什么?

解决方案

看起来您还忘记了更新远程存储库。因此,在rep_A中执行 git remote update (它可能会警告它不是快进更新,因为您似乎在两端都进行了rebase),那么历史记录应该是相同的。

git status tells me that my branch and the one I started from on another repository have diverged:

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 13 and 13 different commit(s) each, respectively.

but the commit history for each is identical. That is, git log shows the same commits, in the same order, with the same SHA-1 hashes. That's for the last 13 commits, and everything before that too.

What's going on?! Or have I misunderstood something fundamental - git's all new to me.

It's quite a long story how I got into this mess - git-svn, cygwin, EGit, pull --rebase with spurious conflicts - but I'm wondering if it's possible this "divergence without any differences" is due to newlines? I've opened files in notepad, and read lots about svn/git/cygwin and CRLF but without any revelations.

Edit OK. Most of the above isn't really the problem. Maybe I don't understand git log or something has got messed up somewhere...

I have two repositories. If I go to rep_A and run git log I get the same result (notably same SHA-1) as if I go to rep_B and run git log.

At rep_A, if I run git log origin/master I get the different commit history I expect. (Different SHA-1s, but same messages - how I created this mess is another story.)

git remote -v show assures me that the origin is where I expect it to be.

git log, on rep_B, isn't behaving how I expected. It's like it's giving me the commit history for rep_A. What have I missed?

解决方案

It looks like you also forgot to update remote repositories. So do git remote update in rep_A (it will probably warn it is not fast-forward update as you seem to do rebase on both ends) and then the histories should be identical.

这篇关于分支显然是分歧的,但提交历史是相同的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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