Tobias Kienzler
Tobias Kienzler

Reputation: 27393

How to get only git revisions that are branch heads?

Given a history such as

commit         | ref
---------------+------------------------------
3ad2c1         | master
b34b14         |
afeg41         | origin/merge-requests/421
1fea34         |
6422bc         |
15fcda         | origin/merge-requests/152

How can I can get a list of only the named refs, i.e. master, origin/merge-requests/{421,152} between two given commits?

Upvotes: 1

Views: 38

Answers (1)

VonC
VonC

Reputation: 1323203

For the origin part, you could use git for-each-ref with a pattern

 git for-each-ref --format='%(objectname:short)' refs/remotes/origin/merge-requests/*

That would limit to the merge-requests branches.

Upvotes: 1

Related Questions