我在多个存储库(比如repo-1,repo-2,repo-3)上工作,所有存储库都有公共分支名称(branch-1,branch-2,branch-3)。有没有办法在所有存储库中找到提交到branch-1的提交历史记录,其中包括' commit-A'(在repo-1,branch-1上)和' commit-E' (在repo-3,branch-1上)。
答案 0 :(得分: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