2017-05-14 86 views
0

我在多个存储库(比如repo-1,repo-2,repo-3)上工作,并且所有存储库都有通用的分支名称(branch-1,branch-2,分支-3)。有没有办法在'commit-A'(回购-1,分支-1)和'commit-E'(回购-3,分支-1)之间的所有库中找到提交分支-1的历史记录。GIT查找跨分销商的分支上的提交历史记录

+0

存储库是否相关?意思是他们的叉子? –

+0

这很有趣[回购](https://github.com/dreamyguy/gitlogg),它可能很有用。 – Sylogista

+0

@ LasseV.Karlsen是的。存储库是相关的。 –

回答

0

你可以在任何git仓库中做到这一点。但为了保持一切清洁,让我们在临时回购中进行。

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 
相关问题