如何比较 Git 中一个分支的 HEAD 提交与另一分支的 HEAD 提交?

发布于 2025-01-14 10:26:48 字数 372 浏览 0 评论 0原文

我有 2 个本地分支,branch1 和 newer_branch1。

branch1 将 commit#1 作为 HEAD 提交,newer_branch1 也是如此,但我不知道branch1 是否实际上与 newer_branch1 是最新的,因为 newer_branch1 具有最新版本的提交。它们还具有完全相同的提交消息,因此我不能简单地根据提交文本判断它们是不同的提交版本。

我尝试仅使用 git diff ID#X..ID#Y 查看 HEAD 提交差异(其中 ID#X 是 newer_branch1 HEAD 提交的 SHA ID#,ID#Y 是 SHA ID) # of Branch1) 但我看到 git 日志中的较旧提交被 diff'd 代替。

我该怎么做?谢谢。

I have 2 local branches, branch1 and newer_branch1.

branch1 has commit#1 as the HEAD commit and so does newer_branch1, but I don't know if branch1 is actually up to date with newer_branch1, as newer_branch1 has the most recent version of the commit. They also have the same exact commit messages so I can't simply tell they're different commit versions based on commit text.

I tried to view only the HEAD commit diffs with git diff ID#X..ID#Y (where ID#X is the SHA ID# of newer_branch1 HEAD commit, and ID#Y is the SHA ID# of branch1) but I am seeing older commits from the git log being diff'd instead.

How can I do this? Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文