Show the original branch for a commit

后端 未结 9 2211
野的像风
野的像风 2020-12-05 04:14

I\'ve used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I\'ll use the branch name to find the particular t

9条回答
  •  一生所求
    2020-12-05 04:57

    When you on the branch the "original branch" was merged to. You may run:

    git log ..HEAD --ancestry-path --merges
    

    This command will show all merge commits between ..HEAD. You need last one.

    For example for c0118fa commit (last but one) the "original branch" is redesign_interactions

    * ccfd449 (HEAD -> develop) Require to return undef if no digits found
    *   93dd5ff Merge pull request #4 from KES777/clean_api
    |\  
    | * 39d82d1 Fix tc0118faests for debugging debugger internals
    | * ed67179 Move &push_frame out of core
    | * 2fd84b5 Do not lose info about call point
    | * 3ab09a2 Improve debugger output: Show info about emitted events
    | *   a435005 Merge branch 'redesign_interactions' into clean_api
    | |\  
    | | * a06cc29 Code comments
    | | * d5d6266 Remove copy/paste code
    | | * c0118fa Allow command to choose how continue interaction
    | | * 19cb534 Emit &interact event
    

    You should run:

    git log c0118fa..HEAD --ancestry-path --merges
    

    And scroll down to find last commit. Which is:

    commit a435005445a6752dfe788b8d994e155b3cd9778f
    Merge: 0953cac a06cc29
    Author: Eugen Konkov
    Date:   Sat Oct 1 00:54:18 2016 +0300
    
        Merge branch 'redesign_interactions' into clean_api
    

提交回复
热议问题