GIt ,获取合并到另一个特定分支的最新提交哈希
GIt , get latest commit hash of a specific branch merged in another
有一个分支,我需要知道另一个合并分支的最新提交的哈希值。
这是我的具体情况:
分支 A 与 分支 C
的提交 X 合并
分支 B 与 分支 C 的提交 Y 合并
如何找到提交 X 和 Y 的哈希值?
是否有 git 命令来检索它?
选择您最喜欢的套房:
git 合并基础
git merge-base
是你要找的命令
git merge-base finds best common ancestor(s) between two commits to use in a three-way merge. One common ancestor is better than another common ancestor if the latter is an ancestor of the former. A common ancestor that does not have any better common ancestor is a best common ancestor, i.e. a merge base. Note that there can be more than one merge base for a pair of commits.
从日志中手动查找
git log --decorate --graph --oneline --all
这将在日志中显示分叉点,以便您可以跟踪分支的提交 ID。
样本:
给定两个提交 A 和 B,git merge-base A B
将输出一个可以通过父关系从 A 和 B 到达的提交。
有一个分支,我需要知道另一个合并分支的最新提交的哈希值。
这是我的具体情况:
分支 A 与 分支 C
的提交 X 合并分支 B 与 分支 C 的提交 Y 合并
如何找到提交 X 和 Y 的哈希值?
是否有 git 命令来检索它?
选择您最喜欢的套房:
git 合并基础
git merge-base
是你要找的命令
git merge-base finds best common ancestor(s) between two commits to use in a three-way merge. One common ancestor is better than another common ancestor if the latter is an ancestor of the former. A common ancestor that does not have any better common ancestor is a best common ancestor, i.e. a merge base. Note that there can be more than one merge base for a pair of commits.
从日志中手动查找
git log --decorate --graph --oneline --all
这将在日志中显示分叉点,以便您可以跟踪分支的提交 ID。
样本:
给定两个提交 A 和 B,git merge-base A B
将输出一个可以通过父关系从 A 和 B 到达的提交。