gpt4 book ai didi

git 识别两个分支最近的交集

转载 作者:太空狗 更新时间:2023-10-29 13:17:09 24 4
gpt4 key购买 nike

是否有一个简写来标识两个分支共同的最后一次提交?例如,如果我有 master,然后 topic1 从 master 中分离出来,它们都继续

master:
a------b------c------d
\
topic1: r------s------t

Is there a way to identify say b?
For example if there was such a thing as master#topic1 (same as topic1#master) that meant, "the most recent commit shared by both master and topic."

I would like to be able to:

$ git checkout topic1
$ git diff master#topic1..topic1

我知道我能做到:

git diff master..topic

但我不关心提交 cd

最佳答案

使用git merge-base .

NAME
git-merge-base - Find as good common ancestors as possible for a merge

SYNOPSIS
git merge-base [-a|--all] [--octopus] <commit> <commit>…
git merge-base --independent <commit>…

关于git 识别两个分支最近的交集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4789812/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com