Chr*_*ler 2 git changelog bitbucket
我正在尝试生成项目的变更日志(bitbucket.org中的仓库),但是找不到简单的解决方案。我们正在使用这种模式
(<type>(<scope>): <subject>)
Run Code Online (Sandbox Code Playgroud)
填充提交消息,并标记版本(0.1、0.2、0.3)。
有什么现成的东西(某些脚本,npm包等),或者我能做的最好的事情就是使用git log编写一些自定义脚本并解析数据(提交消息等)。 ?
我知道有一个github-changelog-creator,但是只要这个仓库在一个bitbucket仓库中,我就不能使用。
我们正在使用这个简单的Shell脚本来生成按标签排列的分层更改日志,其中最新标签位于顶部。
#!/usr/bin/env bash
previous_tag=0
for current_tag in $(git tag --sort=-creatordate)
do
if [ "$previous_tag" != 0 ];then
tag_date=$(git log -1 --pretty=format:'%ad' --date=short ${previous_tag})
printf "## ${previous_tag} (${tag_date})\n\n"
git log ${current_tag}...${previous_tag} --pretty=format:'* %s [View](https://bitbucket.org/projects/test/repos/my-project/commits/%H)' --reverse | grep -v Merge
printf "\n\n"
fi
previous_tag=${current_tag}
done
Run Code Online (Sandbox Code Playgroud)
您可以将其作为一些shel文件放在项目根目录中并运行(取决于您的平台,可能需要使其可执行),如下所示
sh change-log-builder.sh > changelog.md
Run Code Online (Sandbox Code Playgroud)
生成的changelog.md看起来像这样
| 归档时间: |
|
| 查看次数: |
1381 次 |
| 最近记录: |