Git changelog:如何将所有更改都添加到特定标记?

Luw*_*uwe 23 git logging changelog

是否有一种简单的方法或命令可以将所有git提交到特定标记以生成项目的自动更改日志?我总是使用版本号来标记我的git repos,v0.1.0例如,所有提交都要提交标记v0.1.0.

我查看了文档,但似乎没有找到有用的选项或命令:http://git-scm.com/docs/git-log(顺便说一句,此刻已经失效)

例如:

$ git log --oneline --decorate
Run Code Online (Sandbox Code Playgroud)

显示提交旁边的标记.我想要一样,但只有特定的标签.

Mar*_*air 38

你可以这样做:

git log --oneline --decorate v0.1.0
Run Code Online (Sandbox Code Playgroud)

...显示每个提交,包括v0.1.0.当然,git logallow还允许您限制以任何git rev-list理解方式显示的提交,因此如果您只想查看之间的更改v0.0.9,v0.1.0您还可以执行以下操作:

git log --oneline --decorate v0.0.9..v0.1.0
Run Code Online (Sandbox Code Playgroud)

可能对此目的有用的替代输出是,git shortlog对每个作者的贡献进行分组和总结.试试,例如:

git shortlog v0.1.0
Run Code Online (Sandbox Code Playgroud)

  • 要在特定标记之后显示提交,您可以使用`git log --oneline --decorate v0.1.0..` (2认同)

And*_*aev 6

为了按标签创建更改日志,我使用了以下脚本:

#!/bin/bash
# Author:Andrey Nikishaev
echo "CHANGELOG"
echo ----------------------
git tag -l | sort -u -r | while read TAG ; do
    echo
    if [ $NEXT ];then
        echo [$NEXT]
    else
        echo "[Current]"
    fi
    GIT_PAGER=cat git log --no-merges --format=" * %s" $TAG..$NEXT
    NEXT=$TAG
done
FIRST=$(git tag -l | head -1)
echo
echo [$FIRST]
GIT_PAGER=cat git log --no-merges --format=" * %s" $FIRST
Run Code Online (Sandbox Code Playgroud)