How to know whether a commit merged from another branch with gitlab api? Or with git command? Thanks!
            Asked
            
        
        
            Active
            
        
            Viewed 441 times
        
    2 Answers
4
            
            
        Git exposes this information with git log command. You are able to filter this further by only looking for specifically merge commits with --merges
    git log --merges
Try the above command with the branch you are interested in. You should be able to see the history of where the changes were merged from.
 
    
    
        Michael Leigh
        
- 51
- 3
- 
                    thanks,but seems not solve my problem. for example:I have 3 commits on branch a,then I checkout to branch b,and merge from a.As I think those 3 commits belong to branch a.I don't know whether am i misunderstanding? – Dophin Oct 12 '17 at 09:40
1
            
            
        This answer by @Jefromi shows two ways that might be what you are looking for:
Find branches the commit is on:
git branch --contains <commit>
Find a subsequent merge commit:
git log --merges <commit>..
And this other one by @gawi shows a way to list branches not yet merged in a specific branch:
List branches with commits not merged into master:
git branch --no-merged master
 
    
    
        dbkreling
        
- 101
- 1
- 6
