没有什么可比较的。没有什么可比较的,分支是完全不同的提交历史 [英] There isn't anything to compare. Nothing to compare, branches are entirely different commit histories

查看:1916
本文介绍了没有什么可比较的。没有什么可比较的,分支是完全不同的提交历史的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的机器上安装了CMS主题。我通过git
跟踪对它的更改,并决定将它备份到GitHub上,以便我可以共享这些更改。



所提供的主题也可用在GitHub上。在我的机器上,我添加了
作为远程上游。现在,我可以通过使用以下命令轻松查看主
和远程上游之间的更改:

  git diff --color master upstream / number 

如果我可以在GitHub上添加远程上游,我可以轻松地共享这些变化。
是否可以在GitHub上设置这种关系?



我试过以下内容:

  git push -u origin upstreambranch 

添加了一个 upstreambranch 到GitHub上的master。然而,试图
比较两个分支不起作用,我在GitHub上得到的结果是:有
是没有比较的任何东西


解决方案

简答



看起来GitHub不会让你比较分支,因为 它们不是
实际上共享任何相同的历史记录,
偶数尽管他们可能会共享
大部分相同的文件和代码。



以下是我用repo创建的临时分支的屏幕截图,其中我尝试了
比较 master upstreambranch ,就像你所描述的那样。注意错误
消息:



它说:


没有任何东西可以比较。

master upstreambranch 是完全不同的提交历史记录。



长答案



您可能已下载原始资料并添加它到一个全新的
仓库,而不是克隆原始仓库,对吧?这样做会使
的回购历史与原始回购的
历史 完全不同 ,因为您的新回购将不会有任何相同的
提交相同的sha ID。



您可以看到,通过对 master 分支和
upstreambranch

 git log --reverse master 
commit c548d7b1b16b0350d7fbdb3ff1cfedcb38051397#< == HERE
作者:Padraic Stack < padraic.stack@nuim.ie>
日期:星期三4月2日15:11:28 2014 +0100

第一次提交的所有内容

#首次提交原始回购库中的sha
git log --reverse upstreambranch
commit 105a12817234033c45b4dc7522ff3103f473a862#< == THERE
作者:Jeremy Boggs< jeremy@clioweb.org>
日期:1月22日星期一16:00:53 2010 +0000

为Seasons主题创建回购目录。



解决方案



如果您重做您的提交在原始历史的顶部,您应该可以通过
来比较分支机构。有几种不同的方式可以重做您的
提交,包括

  git rebase --onto 

 如果必须的话,您也可以手动重做每个提交。


I have a CMS theme installed on my machine. I'm tracking changes to it via git and decided to back it up on GitHub so I could share those changes.

The theme as provided is also available on GitHub. On my machine I have added this as a remote upstream. Now I can easily see the changes between my master and the remote upstream by using the following command:

git diff --color master upstream/number

If I could add the remote upstream on GitHub I could easily share these changes. Is it possible to set this relationship on GitHub?

I have tried the following:

git push -u origin upstreambranch

which adds an upstreambranch to the master on GitHub. However trying to compare both branches doesn't work, the result I get on GitHub is that: "There isn't anything to compare"

Is there an alternative way to compare these?

解决方案

The Short Answer

It looks like GitHub won't let you compare the branches because they don't actually share any of the same history at all, even though they may share much of the same files and code.

Here is a screenshot of the temporary fork I made of your repo, where I tried to compare master with the upstreambranch, like you described. Notice the error message:

It says:

There isn't anything to compare.

master and upstreambranch are entirely different commit histories.

The Long Answer

You probably downloaded the original source and added it to a completely new repo instead of cloning the original repo, right? Doing that will make it so that the history of your repo will be completely different from the history of the original repo, since your new repo won't have any of the same commits with the same sha IDs.

You can see that by doing a reverse log of your master branch and the upstreambranch:

# Your first commit, see commit sha
git log --reverse master
commit c548d7b1b16b0350d7fbdb3ff1cfedcb38051397 # <== HERE
Author: Padraic Stack <padraic.stack@nuim.ie>
Date:   Wed Apr 2 15:11:28 2014 +0100

    First commit of everything

# First commit sha of the original repo
git log --reverse upstreambranch
commit 105a12817234033c45b4dc7522ff3103f473a862 # <== THERE
Author: Jeremy Boggs <jeremy@clioweb.org>
Date:   Mon Feb 22 16:00:53 2010 +0000

    Creates repo directories for the Seasons theme.

Solutions

If you redo your commits on top of the original history, you should then be able to compare the branches. There are several different ways that you can redo your commits, including

git rebase --onto

and

git cherry-pick

You also can redo each commit manually, if you have to.

这篇关于没有什么可比较的。没有什么可比较的,分支是完全不同的提交历史的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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