[英]Can git list the tags that occur between two particular commits?
有沒有辦法讓 git 列出在兩次提交之間添加的所有標簽? 也就是說,只顯示出現在 A 點和 B 點之間的標簽。
您可以使用帶有以下選項的git log
命令:
git log tagA...tagB --decorate --simplify-by-decoration
--decorate
顯示提交旁邊的標記名稱,而--simplify-by-decoration
僅顯示已標記的提交。
如果您只想要commit1
和commit2
之間的標簽名稱列表(按時間倒序),您可以將git log
與xargs
和git tag --points-at
:
git log commit1..commit2 --simplify-by-decoration --format=format:%h | xargs -L1 git tag --points-at
此命令有效地列出了commit1
和commit2
之間的所有標記(不包括commit1
本身)。
git log --simplify-by-decoration --pretty=format:%D commit1..commit2 | \
grep -o 'tag: [^,)]\+' | sed 's/^tag: //'
git log ...
命令列出了引用指定范圍內每個提交的分支和標簽。 后續命令僅解析標簽。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.