How do I show just the names and commit titles since a tag in Git?
Asked Answered
D

5

73

I'm trying to use tags for release management in Git—I create a tag for each release. I'd like to be able to create release notes by listing the comment titles for every commit since a tag, or between 2 tags. I can't seem to find any way to do this.

Disconcert answered 31/5, 2010 at 5:46 Comment(0)
S
92

If your tags are named LastRelease and NextRelease then do

git log --pretty=format:%s LastRelease..NextRelease .

Submediant answered 31/5, 2010 at 5:57 Comment(3)
Awesome tip; I could never figure out how to get git log to only show partial information. Thank you!Munich
You can also use git log --oneline which prints the title and part of the hash.Phocaea
Additionally, if you want to list all of the commit titles from the start of a branch, you can use previous_branch_name..HEAD instead of LastRelease..NextRelease.Heartbreaking
A
39

To show commits since TAG to current head:

git log TAG..HEAD

Between two commits:

git log TAG..TAG

For formatting the log output have a look at Pretty formats section of git log.

Absolutely answered 31/5, 2010 at 5:49 Comment(1)
This lists more than just titles. See my answer.Submediant
Y
12

You should look into git shortlog. Here's an example of the output:

$ git shortlog
Al Jones (512):
      Added to .gitignore file
      Updated user model

Bob Smith (222):
      Minor tweak to view
      Updated accounts controller

Charles West (321):
      Started specs for user model
      Finished specs for user model

For your case you would want to run git shortlog LastRelease..NextRelease

Yesseniayester answered 18/12, 2012 at 2:59 Comment(0)
F
4

I combined Dominic's and Igor's answers together to return the titles of all commits from 2b150c4 to the current HEAD in chronological order and prints it to Terminal (echo added because git log doesn't line break the last line).

git log --pretty=format:%s 2b150c4..HEAD --reverse | cat; echo
Flowerlike answered 16/2, 2017 at 0:1 Comment(0)
M
3

In order to get detailed infos on commit with a certain (known) message, I firstly call git log --oneline for overview of commints with messeges and then by the identified SHA view the commit with git show <SHA> or git log --stat -p <SHA>

Matchmark answered 14/4, 2018 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.