gpt4 book ai didi

git - 查找两个 git 存储库之间的差异

转载 作者:IT王子 更新时间:2023-10-29 01:17:43 26 4
gpt4 key购买 nike

我在 Github 上 fork 了一个项目的 git 存储库,并对其进行了自己的更改。我想了解我的存储库和原始存储库之间的差异我 fork 的存储库。谁能告诉我 git 命令得到那个差异?我需要提交差异以供审核。

原始存储库:

git://github.com/apache/hive.git

我的仓库:

git@github.com:prafullat/hive.git

这是我的 .git/config 中的详细信息>

[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:prafullat/hive.git
[remote "mirror"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git://github.com/apache/hive.git

我尝试查看有关同一主题的其他已发布问题,并且无法让它工作。

如有任何帮助,我们将不胜感激。

最佳答案

您需要获取两个远程存储库中的最新版本,并将主要分支相互比较。看起来主分支是“主干”分支,因此您可以看到哪些提交是您的项目所特有的(而不是在“镜像”项目的主干分支中),如下所示:

$ git log --oneline origin/trunk ^mirror/trunk
1c4fa82 1. Modified the flag name for gb_to_idx rewrite to hive.ql.rewrite.gb_to_idx So
638be54 Merge branch 'trunk' of git@github.com:prafullat/hive into trunk
72c8220 HIVE-1383. Allow HBase WAL to be disabled (John Sichi via Ning Zhang)
a372259 Checking in commented meta-data methods in GbToCompactSumIdxRewrite. It has to be unc
33c1fb1 Fixing some files due to wrong application of patch. Build now compiles !
5942728 Reverting files which were patched twice in last checkin.
5efda04 Adding inital rewrite changes. This patch adds basic query rewrite support to Hive. I
3fce190 Merge branch 'trunk' of git://github.com/apache/hive into trunk
b3f9ff2 Checking in commented meta-data methods in GbToCompactSumIdxRewrite. It has to be unc
d89deb9 Fixing some files due to wrong application of patch. Build now compiles !
11db7da Reverting files which were patched twice in last checkin.
88fee30 Adding inital rewrite changes.
ba7703f Some part of last check-in got missed.
2c5c5ae Checking initial changes for Hive indexing from He Yongqiang (Hive-417) Here is descr

或者您可以删除 --oneline 以查看完整的提交消息。看起来它们都是你的。如果您不想看到这些 merge 提交,您还可以添加 --no-merges

接下来,您可以通过运行以下命令获取实际差异:

$ git diff --stat mirror/trunk...origin/trunk
README.txt | 4 +-
build.xml | 1 +
.../java/org/apache/hadoop/hive/conf/HiveConf.java | 1 +
ivy/ivysettings.xml | 4 +-
metastore/if/hive_metastore.thrift | 12 +-
.../apache/hadoop/hive/metastore/api/Index.java | 15 +-
.../hive/metastore/api/ThriftHiveMetastore.java | 671 +++++++++++++++++++-
metastore/src/gen-php/hive_metastore_types.php | 30 +-
.../hadoop/hive/metastore/HiveMetaStore.java | 155 ++++-
.../hadoop/hive/metastore/HiveMetaStoreClient.java | 9 +-
.../hadoop/hive/metastore/IMetaStoreClient.java | 14 +
.../hadoop/hive/metastore/MetaStoreUtils.java | 31 +
(bunch more lines)
ql/src/test/queries/clientpositive/index_compact.q | 13 +
.../test/queries/clientpositive/index_projection.q | 13 +
ql/src/test/queries/clientpositive/index_summary.q | 13 +
.../queries/clientpositive/ql_rewrite_gbtoidx.q | 9 +
.../results/clientpositive/index_compact.q.out | 70 ++
.../clientpositive/ql_rewrite_gbtoidx.q.out | 211 ++++++
.../primitive/PrimitiveObjectInspectorUtils.java | 29 +-
57 files changed, 4000 insertions(+), 131 deletions(-)

如果删除 --stat,您将获得实际差异。 mirror/trunkorigin/trunk 之间的 ... 是一种简写,表示您想要共同祖先之间的差异,所以它删除自您开始以来添加到原始项目的所有内容不会给您带来差异,它只会为您提供您在分支上所做的更改。

关于git - 查找两个 git 存储库之间的差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3075460/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com