简体   繁体   English

如何获取两个git存储库之间的changsets列表

[英]How to get a list of changsets between two git repositories

I want to see the different changesets between to git repositories. 我想看看git仓库之间的不同变更集。 The repos are related but neither is the direct origin of the other. 仓库是相关的,但两者都不是直接的。 In Mercurial, I would just do "hg outgoing other-repo " and "hg incoming other-repo ". 在Mercurial中,我只会执行“ hg传出其他回购 ”和“ hg传入的其他回购 ”。

I assume you mean the different changesets between two branches in a repo. 我假设您是指回购中两个分支之间的不同变更集。 In git, you'll have a couple extra steps. 在git中,您需要执行几个额外的步骤。 Go into one of the repos and do the following 进入一个回购协议并执行以下操作

git remote add other OTHER_REPO
git fetch other

Now you can view the differences with one of the following depending on which direction you want to go 现在,您可以根据要选择的方向,使用以下其中一种查看差异

# Similar to hg outgoing (changes which in your branch not in the remote) 
git log other/BRANCH_NAME..BRANCH_NAME

# Similar to hg incoming (changes in the remote not in your branch)
git log BRANCH_NAME..other/BRANCH_NAME

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM