如何查看分叉的github项目的差异 [英] How to view diff of a forked github project

查看:170
本文介绍了如何查看分叉的github项目的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在github上创建了一个项目,并且需要我使用diff格式进行一系列更改。

I have forked a project on github and need to have a set of changes I made since I forked, in diff format.

如果您想知道 - 我已经分叉的Apache httpd,我正在改变核心中的一些代码。目前我没有提交任何更改,运行git diff,并将其输出用作RPM构建过程中针对vanilla httpd源的修补程序。当然,这是错误的,但我不知道如何正确地做到这一点。所有我知道的是我最后需要一个差异。

If you wonder - I've forked Apache httpd and I'm changing some code in core. Currently I'm not commiting any changes, running git diff, and use its output as a patch against vanilla httpd sources in an RPM building process. It is, of course, wrong, but I don't know how to do it properly. All I know is I need a diff in the end.

推荐答案


  • 添加原始的GitHub仓库你已经分叉的那个)作为你本地仓库中的远程仓库。

    git remote add mainRepo github_url

  • git fetch mainRepo 可从原始mainRepo获取最新更改。 b $ b
  • git log HEAD..mainRepo / master 会显示mainRepo主分支上的最新分支与当前分支分支。
    git diff HEAD..mainRepo / master 会以diff格式显示。

    • Add the original GitHub repo (the one you have forked) as a remote one on your local repo.
      (git remote add mainRepo github_url)
    • git fetch mainRepo to get the latest changes from that original "mainRepo".
    • git log HEAD..mainRepo/master will show you all your changes between the latest on mainRepo master branch and your current branch.
      git diff HEAD..mainRepo/master would display it in diff format.
    • learn.GitHub

      git diff mainRepo/master...HEAD
      

      会列出您从 mainRepo 分支的所有更改:

      would list all your changes since you have forked from mainRepo:

      这不会比较最后一个'master'分支快照和上一个'dev'快照 - 它会将两者的共同祖先与'dev'进行比较。这将告诉你自分支点以来发生了什么变化。

      This will not compare the last ‘master’ branch snapshot and the last ‘dev’ snapshot - it will instead compare the common ancestor of both with ‘dev’. That will tell you what changed since the branch point.

      这篇关于如何查看分叉的github项目的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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