首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GIT跨repo查找分支上提交的历史记录

GIT跨repo查找分支上提交的历史记录
EN

Stack Overflow用户
提问于 2017-05-15 03:36:24
回答 1查看 26关注 0票数 0

我使用多个存储库(比如repo-1、repo-2、repo-3),所有的存储库都有共同的分支名称(分支-1、分支-2、分支-3)。有没有办法在‘commit-A’(在repo-1上,分支-1)和'commit-E‘(在repo-3上,分支-1)之间的所有存储库上找到提交到分支-1的历史记录。

EN

回答 1

Stack Overflow用户

发布于 2017-05-15 07:01:28

你可以在任何git repo中做到这一点。但是,为了保持所有内容的整洁和清晰,让我们在临时回购中进行。

代码语言:javascript
复制
git init temp
cd temp
#If you have already known exactly the sha1 values of commit_A and commit_E, 
#":repo1" and ":repo3" in the following two commands can be omitted.
git fetch <repo1_url> branch_1:repo1
git fetch <repo3_url> branch_1:repo3
#If you haven't, find them out first.

#History between commit-A and commit-E is ambiguous.
#It may have three different meanings:
#1.History of commits that are reachable from commit_A but not reachable from commit_E
git log commit_E..commit_A

#2.History of commits that are reachable from commit_E but not reachable from commit_A
git log commit_A..commit_E

#3.History of commits that are either reachable from commit_A or reachable from commit_E, 
#but not reachable from both at the sam time.
git log commit_A...commit_E
#or
git log commit_E...commit_A

#Finally remove the temporary repo.
cd ..
rm -rf temp
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43968070

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档