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.
Git Log OnelineThe oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
Find Latest Git Tag Available In order to find the latest Git tag available on your repository, you have to use the “git describe” command with the “–tags” option. This way, you will be presented with the tag that is associated with the latest commit of your current checked out branch.
To see the changes between two commits, you can use git diff ID1.. ID2 , where ID1 and ID2 identify the two commits you're interested in, and the connector .. is a pair of dots. For example, git diff abc123.. def456 shows the differences between the commits abc123 and def456 , while git diff HEAD~1..
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With