2

As frequent GIT user, I love git log --graph as much as I love git tag. I was made responsible for a large GIT repository with too many branches and tags and I am proceeding too slowly with the sisyphusian work of reducing those numbers.

It would be extremely helpful is to have a tag tree graph, just like a usual commit graph, but only with those branches which have tags on it. I would also need the hash of each tagged commit (and ideally also the time-stamp and author).

I searched a lot, but I never found anything like what I described.

Some references (of ever so many)

B--rian
  • 5,578
  • 10
  • 38
  • 89
  • 2
    `git log --graph --oneline --simplify-by-decoration`; see [here](https://git-scm.com/docs/git-log#_pretty_formats) for `--pretty:tformat=...` option instead of `--oneline` to specify exactly what to include and how it should look. – Amadan Dec 19 '19 at 08:35
  • Uups, that was easy. Thanks! It is a shame that I did not know that before. Since which version is that possible?! – B--rian Dec 19 '19 at 08:36

1 Answers1

1

As Amadan pointed out, I should have dived deeper into the git-log documentation in the most recent version. The solution is simply to include the --simplify-by-decoration flag. Altogether, I ended up with the following

git log --graph --simplify-by-decoration --pretty=format:'%C(yellow)%h %ad %an%Cgreen%d %Creset%s' --date=short

The official formatting documentation explains all the details of --pretty=format:'...', the most important parts are

  • %h = abbreviated commit hash
  • %an = author name
  • %ad = author date
  • %s = subject

If want something to memorize, just use

git log --graph --simplify-by-decoration

This gives you an output without of commit hash and git-tag only.

B--rian
  • 5,578
  • 10
  • 38
  • 89