Get branch name from the most recent merge commit

Viewed 674

Whenever a branch starting with release/* (like release/1.0.0 or release/1.0.1) gets merged into master I would like to run a bash script on master branch. The script requires the name of the branch which was most recently merged into master (like release/1.0.1)

I have been trying for a few hours now but am not able to figure out and at most have found that it is somewhere along the lines of

git for-each-ref --count=1 --sort=-committerdate

git reflog show master

git show :/^Merge

Can I get branch name (like release/1.0.1) from the most recent merge commit on master branch?

0 Answers
Related