标签之间的 Git 日志

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8136178/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 12:18:17  来源:igfitidea点击:

Git log between tags

git

提问by digital

I'm trying to output the log between two tagged commits.

我正在尝试输出两个标记提交之间的日志。

mbell@cheetah [12:07:22] [/var/www/html/brone] [dev]
-> % git tag 
6.x-0.1
6.x-1.0-beta1
6.x-1.0-beta2
6.x-1.0-beta3
6.x-1.0-beta4
6.x-1.0-beta5
6.x-1.0-beta6
6.x-1.0-beta7
6.x-1.0-beta8
6.x-1.0-beta9

If I then do:

如果我这样做:

git log 6.x-1.0-beta8 6.x-1.0-beta9 > ~/gitlogbrone.txt

git log 6.x-1.0-beta8 6.x-1.0-beta9 > ~/gitlogbrone.txt

It outputs all the commits since the start of the repo which isn't what I want. I've read through the git log manual but it's not helping much.

它输出自 repo 开始以来的所有提交,这不是我想要的。我已经通读了 git log 手册,但它没有多大帮助。

回答by Noufal Ibrahim

You need an ellipsis to indicate a range. Try git log tag1..tag2.

您需要一个省略号来表示一个范围。试试git log tag1..tag2

回答by wilmol

I use this to get the commits between the last 2 tags:

我用它来获取最后 2 个标签之间的提交:

git log --pretty=format:%s `git tag --sort=-committerdate | head -1`...`git tag --sort=-committerdate | head -2 | awk '{split(##代码##, tags, "\n")} END {print tags[1]}'` > change_log.txt