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.
1 answer. You just need to check the length of the `parents`. If there are two or more commits, it's a merge commit, otherwise it's a regular commit.
You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.
$ git branch -d testing error: The branch 'testing' is not fully merged. If you are sure you want to delete it, run 'git branch -D testing'.
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
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.
I now see that Sulli also provides the same answer in this thread.
With
git log --oneline devBranch..featureBranch
You see all commits present in featureBranch and not in devBranch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With