簡體   English   中英

列出所有分支的所有標簽,這些分支比master上的最新標簽小

[英]List all tags from all branches younger than the latest tag on master

為了自動化,我需要從所有分支中查找所有標簽,這些分支比master上的最新標簽還年輕。

不幸的是,我的代碼還給我返回了一個標簽,該標簽是最新的

git describe  --abbrev=0 --tags $(git rev-list --tags --date-order --since="$(git log -1 --format=%at $(git describe --abbrev=0 --tags))") | sort -u

在主人上,我有標簽
R.01.02.03
R.01.01.01

在功能分支上,我有標簽(它們比主標簽上的標簽年輕)
B.02.01.01
B.02.01.02
B.02.01.03
B.02.01.04

我得到一個清單:
B.02.01.01
B.02.01.02
B.02.01.03
B.02.01.04
R.01.02.03
R.01.01.01

我需要一個清單:
B.02.01.01
B.02.01.02
B.02.01.03
B.02.01.04

# Get the last tag on master
LAST_MASTER_TAG=`git describe --tags --abbrev=0 master`

# Get its taggerdate in Unix timestamp format
LMT_UNIX_DT=`git for-each-ref --format '%(taggerdate:unix)' refs/tags/$LAST_MASTER_TAG`

# List all tags in the format `refname unix_timestamp`
# and filter the list by those timestamps
# that are greater then LMT_UNIX_DT
git for-each-ref --sort=taggerdate --format='%(refname) %(taggerdate:unix)' refs/tags/ |
while read refname dt; do
    if test $dt -gt $LMT_UNIX_DT; then
        echo $refname;
    fi;
done

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

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