2017-05-14 85 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 
相關問題