How can I see what branch another branch was forked from?

前端 未结 4 625
甜味超标
甜味超标 2020-12-05 02:23

My git repository has three branches, devel, stable and customers/acme_patches. A long time ago, stable was forked from <

4条回答
  •  执念已碎
    2020-12-05 03:16

    Well, there is probably no perfect solution to this answer. I mean there is no fork-origin equivalent in git (to my knowledge). Because the stable branch is merged into devel, your acme_patches (from 1) is on both devel and stable branch.

    What you could possibly do is:

    git branch --contains $(git merge-base customers/acme_patches devel stable)
    

    If you have stable and not devel, or devel and not stable, then you know where it comes from.

    For example, in the case 2, you would have

    $ git branch --contains $(git merge-base customers/acme_patches devel stable)
    customers/acme_patches
    devel
    

    while in case 1 you would have

    $ git branch --contains $(git merge-base customers/acme_patches devel stable)
    customers/acme_patches
    devel
    stable
    

    As it's now on both branches (because of the merge from stable to dev)

提交回复
热议问题