繁体   English   中英

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

[英]Getting the difference between two repositories at specified commits

我正在尝试比较给定提交时两个存储库之间的差异。 我遇到的最接近的StackOverflow 帖子建议添加一个 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

提交哈希在分支(和宇宙)上是唯一的

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM