列出比 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
在 master 上我有标签
R.01.02.03
R.01.01.01
在特性分支上我有标签(它们比 master 上的标签更年轻)
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
出于自动化目的,我需要从所有分支中找到比 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
在 master 上我有标签
R.01.02.03
R.01.01.01
在特性分支上我有标签(它们比 master 上的标签更年轻)
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