简体   繁体   English

列出所有分支的所有标签,这些分支比master上的最新标签小

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

For automation purposes I need to find all tags from all branches which are younger than the latest tag on master. 为了自动化,我需要从所有分支中查找所有标签,这些分支比master上的最新标签还年轻。

My code is unfortunately returning me as well one tag which is one before the latest 不幸的是,我的代码还给我返回了一个标签,该标签是最新的

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

On master I have tags 在主人上,我有标签
R.01.02.03 R.01.02.03
R.01.01.01 R.01.01.01

on feature branches I have tags (they are younger than tags on master) 在功能分支上,我有标签(它们比主标签上的标签年轻)
B.02.01.01 B.02.01.01
B.02.01.02 B.02.01.02
B.02.01.03 B.02.01.03
B.02.01.04 B.02.01.04

I get a list: 我得到一个清单:
B.02.01.01 B.02.01.01
B.02.01.02 B.02.01.02
B.02.01.03 B.02.01.03
B.02.01.04 B.02.01.04
R.01.02.03 R.01.02.03
R.01.01.01 R.01.01.01

I need a list: 我需要一个清单:
B.02.01.01 B.02.01.01
B.02.01.02 B.02.01.02
B.02.01.03 B.02.01.03
B.02.01.04 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