15

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.

Dzhuneyt
  • 8,437
  • 14
  • 64
  • 118

3 Answers3

33

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.

Ytsen de Boer
  • 2,797
  • 2
  • 25
  • 36
6

Using the following command:

git branch --contains <commit-id>

This will output every branch which contain the commit. So if your current branch has it, it should appear in the output.

Sulli
  • 356
  • 2
  • 8
3

With

git log --oneline devBranch..featureBranch

You see all commits present in featureBranch and not in devBranch

Ekans
  • 997
  • 1
  • 8
  • 16