Git log between tags

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

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.


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


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

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

Thanks to @Noufal Ibrahim for his answer.

I was committing a file and creating a new tag. But before doing that, my need was to list and format all of the commits after the last tag created. Here is what I did that time:

$ git log <last_tag>..

Notice double dot (..) at the end


A bit optimised solution from @wilmol

git log --pretty=oneline `git tag --sort=-committerdate | head -1`...`git tag --sort=-committerdate | head -2 | tail -1`

I prefer to use in scripts for the release notes the following code:

git log --pretty=oneline `git tag --sort=-committerdate | head -1`...`git tag --sort=-committerdate | head -2 | tail -1` |cut -d " " -f 2- |grep -v "Merge pull request"

This one give a clear commits history between two last tags without git has and merge lines.