如何仅获取分支头的git版本?

时间:2019-03-27 20:23:23

标签: git branch git-log

给出历史记录,例如

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

如何获取仅两次引用之间的命名引用列表,即master, origin/merge-requests/{421,152}

1 个答案:

答案 0 :(得分:1)

对于原点,您可以使用git for-each-ref with a pattern

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

那将限制到合并请求分支。