Fatemeh Hosseini
Fatemeh Hosseini

Reputation: 91

How to get the list of merged branches after a specific git tag?

I can see branches of merged commits on my master branch since the last tag like this: git log $(git describe --tags --abbrev=0)..HEAD --oneline enter image description here But I cannot extract branch names from the above command, because it just includes commits when I write the output to a file. I also tried git branch -r --merged which is closer to what I want but how can I get only branches after a specific tag?

Upvotes: 1

Views: 2425

Answers (1)

Darpan Rangari
Darpan Rangari

Reputation: 1570

This will give you what all branches merged into master form tag TagFrom to TagTo:

git log --oneline --merges --date-order TagFrom..TagTo | sed "s/ Merge branch '/|/;s/.*/|&|/;s/' into 'master'//"

or you can get form date when the last tag:

git log -1 --format=%ai MY_TAG_NAME e.g.: git log -1 --format=%ai MT_TAG_NAME

(this will generate the time of last tag pushed)

Use that time to find the list of all commits from teams.

git log --after="2018-08-02" --merges --name-only --decorate --first-parent --pretty=format:%s

Upvotes: 3

Related Questions