簡體   English   中英

git 可以列出兩個特定提交之間發生的標簽嗎?

[英]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僅顯示已標記的提交。

如果您想要commit1commit2之間的標簽名稱列表(按時間倒序),您可以將git logxargsgit tag --points-at

git log commit1..commit2 --simplify-by-decoration --format=format:%h | xargs -L1 git tag --points-at

此命令有效地列出了commit1commit2之間的所有標記(不包括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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM