Search code examples
gitmergeatlassian-sourcetreesourcetree

How to check if a commit has been merged to my current branch - somewhere in time?


I have a random feature/XXXXXXX branch that has some commits and naturally the "develop" branch where those features are eventually merged.

How do I check if a certain old commit (e.g. commit ab123456 from branch feature/user-registration) has been somehow brought/merged to my currently active branch (e.g. develop)? Either by directly merging the feature branch to develop or by going up/merged through some other intermediary branch.

Through git commands or through SourceTree UI, both ways are equally suitable for me.


Solution

  • Solution

    You can ask git directly, which (local) branches contain your commit, like so:

    git branch --contains ab123456
    

    use the "-r" option to query for remote branches, like so:

    git branch -r --contains ab123456
    

    References

    As Andrew C. comments, this is practically a duplicate of How to list branches that contain a given commit? correctly and elaborately answered by VonC.

    Note

    I now see that Sulli also provides the same answer in this thread.