Reputation: 64709
Given two git commit hashes, how do you lookup the branch names of all associated merges in between those commits?
I'm trying to write a script to collect some statistics about which branches have been merged into a specified target branch between two given dates.
I know you can get a list of all branches merged into a target branch with a command like:
git branch --merged <target_branch>
but how do you limit it to a certain range of commits?
Upvotes: 1
Views: 387
Reputation: 37448
I think you just need to add the name of the branch of interest to @Andrew Miners answer. I've used something like the following to check for differences between two commits on the origin to generate release notes:
git fetch
git log --merges --first-parent --oneline origin 3c06b3544a9f86d3f0cbe57e0ef6dafda850945c..caf05bfb706ae958f73b8bbe997b0c431ffbdb9c
Upvotes: 1
Reputation: 6125
I think you want to use the git log
command with the --merges
flag. So, for example, if you want to find all the merges between release-1.0
and release-2.0
, you'd say:
git log release-1.0..release-2.0 --merges
Upvotes: 1