获取指定提交时两个存储库之间的差异

Getting the difference between two repositories at specified commits

我正在尝试比较给定提交时两个存储库之间的差异。我遇到的最接近的 Whosebug post 建议添加一个 repo 作为远程以使用以下命令与工作 repo 进行比较:

git remote add -f b path/to/repo_b.git
git remote update
git diff master remotes/b/master
git remote rm b

但是,如果我想与 repo_b(而不仅仅是分支)的特定过去提交的点进行比较,我该怎么做?

只需使用提交哈希而不是 git diff 中的分支名称。例如:

git remote add -f b path/to/repo_b.git
git remote update
git diff 547cd49 600cd49
git remote rm b

提交散列在分支(和宇宙)中是唯一的