# How to trim the fat on my log graphs

8 messages from 2014-04-22 to 2014-04-23. Participants: Robert Dailey, Junio C Hamano, Jeff King, Felipe Contreras.
Thread: https://gitlist.dev/t/36475

## Robert Dailey, 2014-04-22 20:50

Subject: How to trim the fat on my log graphs
Message-ID: <CAHd499Bq07mPTR=h-5Gj=NuEQ9WLnK2wL5nxTNMe=LFnKHmvzA@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499Bq07mPTR%3Dh-5Gj%3DNuEQ9WLnK2wL5nxTNMe%3DLFnKHmvzA%40mail.gmail.com

```
My log graphs are pretty insane sometimes because we converted our
repo from SVN and haven't had a chance to delete all of the remote
branches. We still have quite a few (maybe 20).

When I do `git log`, I am shown about 10-15 vertical lines and the
branch I currently have checked out isn't even at the top of the
graph, it's burried somewhere one or two pages down. I think this is
really confusing and makes my log virtually useless. Here is my log
command:

git log log --graph --abbrev-commit --decorate --date=relative
--format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes

I realize the `git log` documentation has a whole section on trimming
history so it is more useful, but after reading that section I am left
completely confused and I have no idea which additional options I can
add to trim the fat on my logs.

Ideally what I want, for starters:
- The branch I'm on should be at the top of the graph (first commit in
the log graph should be the tip of my checked out branch).
- Commits in other branches that are not ancestors of the current
branch should not be shown.
- Merges *into* my branch from other branches should show the graph
line for that branch but allow me to specify a "depth", meaning for
example that ancestors that are 3 "parents" away
(great-grandchildren?) will not be rendered (the 3 is an example, I
could specify any number)

The goal is to weed out the really distant and irrelevant commits. I
really just want to see the commits that are closely related to my
current branch. Thanks in advance.

```

## Junio C Hamano, 2014-04-22 21:37

Subject: Re: How to trim the fat on my log graphs
Message-ID: <xmqqtx9l2ggp.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqtx9l2ggp.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHd499Bq07mPTR=h-5Gj=NuEQ9WLnK2wL5nxTNMe=LFnKHmvzA@mail.gmail.com>

```
Robert Dailey <rcdailey.lists@gmail.com> writes:

> git log log --graph --abbrev-commit --decorate --date=relative
> --format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
> green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
> white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes
> ...
> The goal is to weed out the really distant and irrelevant commits. I
> really just want to see the commits that are closely related to my
> current branch. Thanks in advance.

For a starter, how about dropping "--branches --remotes" from that
command line?  A merge from elsewhere will show as "Merge branch foo"
which should be sufficient without the decoration.

```

## Robert Dailey, 2014-04-23 16:32

Subject: Re: How to trim the fat on my log graphs
Message-ID: <CAHd499AovROt2fVAvh-ST9Vb7Hq8LpUS68i4eXWZaNszuKeUfg@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499AovROt2fVAvh-ST9Vb7Hq8LpUS68i4eXWZaNszuKeUfg%40mail.gmail.com
In-Reply-To: <xmqqtx9l2ggp.fsf@gitster.dls.corp.google.com>

```
Thanks, removing those two options did help quite a bit already.
However, the history can still get pretty crazy. Is there a way to
hide all tags from the log graph? Really I just want the LABELS to be
hidden.

On Tue, Apr 22, 2014 at 4:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Robert Dailey <rcdailey.lists@gmail.com> writes:
>
>> git log log --graph --abbrev-commit --decorate --date=relative
>> --format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
>> green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
>> white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes
>> ...
>> The goal is to weed out the really distant and irrelevant commits. I
>> really just want to see the commits that are closely related to my
>> current branch. Thanks in advance.
>
> For a starter, how about dropping "--branches --remotes" from that
> command line?  A merge from elsewhere will show as "Merge branch foo"
> which should be sufficient without the decoration.

```

## Junio C Hamano, 2014-04-23 17:30

Subject: Re: How to trim the fat on my log graphs
Message-ID: <xmqqha5k0x8c.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqqha5k0x8c.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHd499AovROt2fVAvh-ST9Vb7Hq8LpUS68i4eXWZaNszuKeUfg@mail.gmail.com>

```
Robert Dailey <rcdailey.lists@gmail.com> writes:

[Administrivia: because people read from top to bottom / why is it
bad to top-post? / please do not top-post.]

> On Tue, Apr 22, 2014 at 4:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Robert Dailey <rcdailey.lists@gmail.com> writes:
>>
>>> git log log --graph --abbrev-commit --decorate --date=relative
>>> --format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
>>> green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
>>> white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes
>>> ...
>>> The goal is to weed out the really distant and irrelevant commits. I
>>> really just want to see the commits that are closely related to my
>>> current branch. Thanks in advance.
>>
>> For a starter, how about dropping "--branches --remotes" from that
>> command line?  A merge from elsewhere will show as "Merge branch foo"
>> which should be sufficient without the decoration.
>
> Thanks, removing those two options did help quite a bit already.
> However, the history can still get pretty crazy. Is there a way to
> hide all tags from the log graph? Really I just want the LABELS to be
> hidden.

As you had --decorate and a lot of %C(cruft), I was assuming that
you do want to see all the bells and whistles when I suggested to
omit --branches and --remotes.

If you do not want --decorate, I think you can omit that from the
command line without changing what the output means.

```

## Robert Dailey, 2014-04-23 19:59

Subject: Re: How to trim the fat on my log graphs
Message-ID: <CAHd499Cw8=FMctRA49MUi+vP2gvMyXH9WgcfCKK_MrKDEOfvjw@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499Cw8%3DFMctRA49MUi%2BvP2gvMyXH9WgcfCKK_MrKDEOfvjw%40mail.gmail.com
In-Reply-To: <xmqqha5k0x8c.fsf@gitster.dls.corp.google.com>

```
On Wed, Apr 23, 2014 at 12:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Robert Dailey <rcdailey.lists@gmail.com> writes:
>
> [Administrivia: because people read from top to bottom / why is it
> bad to top-post? / please do not top-post.]
>
>> On Tue, Apr 22, 2014 at 4:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Robert Dailey <rcdailey.lists@gmail.com> writes:
>>>
>>>> git log log --graph --abbrev-commit --decorate --date=relative
>>>> --format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
>>>> green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
>>>> white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes
>>>> ...
>>>> The goal is to weed out the really distant and irrelevant commits. I
>>>> really just want to see the commits that are closely related to my
>>>> current branch. Thanks in advance.
>>>
>>> For a starter, how about dropping "--branches --remotes" from that
>>> command line?  A merge from elsewhere will show as "Merge branch foo"
>>> which should be sufficient without the decoration.
>>
>> Thanks, removing those two options did help quite a bit already.
>> However, the history can still get pretty crazy. Is there a way to
>> hide all tags from the log graph? Really I just want the LABELS to be
>> hidden.
>
> As you had --decorate and a lot of %C(cruft), I was assuming that
> you do want to see all the bells and whistles when I suggested to
> omit --branches and --remotes.
>
> If you do not want --decorate, I think you can omit that from the
> command line without changing what the output means.

I referred back to the documentation for --decorate:

--decorate[=short|full|no]
Print out the ref names of any commits that are shown. If short is
specified, the ref name prefixesrefs/heads/, refs/tags/ and
refs/remotes/ will not be printed. If full is specified, the full ref
name (including prefix) will be printed. The default option is short.

since default is short, and its documented to exclude tag names, I
would expect them to not be there. I also tried removing it to test
but i saw no difference; tag names are still visible.

```

## Junio C Hamano, 2014-04-23 20:15

Subject: Re: How to trim the fat on my log graphs
Message-ID: <xmqq1twnztt4.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq1twnztt4.fsf%40gitster.dls.corp.google.com
In-Reply-To: <CAHd499Cw8=FMctRA49MUi+vP2gvMyXH9WgcfCKK_MrKDEOfvjw@mail.gmail.com>

```
Robert Dailey <rcdailey.lists@gmail.com> writes:

> On Wed, Apr 23, 2014 at 12:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Robert Dailey <rcdailey.lists@gmail.com> writes:
>>
>> [Administrivia: because people read from top to bottom / why is it
>> bad to top-post? / please do not top-post.]
>>
>>> On Tue, Apr 22, 2014 at 4:37 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>>> Robert Dailey <rcdailey.lists@gmail.com> writes:
>>>>
>>>>> git log log --graph --abbrev-commit --decorate --date=relative
>>>>> --format=format:'%C(bold blue)%h%C(reset)%x09%C(bold
>>>>> green)(%ar)%C(reset)%C(bold yellow)%d%C(reset) %C(dim
>>>>> white)%an%C(reset) - %C(white)%s%C(reset)' --branches --remotes
>>>>> ...
> ... I also tried removing it to test
> but i saw no difference; tag names are still visible.

I do not use these eye-candies myself (they are too distracting for
me), but doesn't "%d" in the format string mean "decorate"?

```

## Jeff King, 2014-04-23 20:44

Subject: Re: How to trim the fat on my log graphs
Message-ID: <20140423204443.GA20379@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20140423204443.GA20379%40sigill.intra.peff.net
In-Reply-To: <CAHd499Cw8=FMctRA49MUi+vP2gvMyXH9WgcfCKK_MrKDEOfvjw@mail.gmail.com>

```
On Wed, Apr 23, 2014 at 02:59:26PM -0500, Robert Dailey wrote:

> I referred back to the documentation for --decorate:
> 
> --decorate[=short|full|no]
> Print out the ref names of any commits that are shown. If short is
> specified, the ref name prefixesrefs/heads/, refs/tags/ and
> refs/remotes/ will not be printed. If full is specified, the full ref
> name (including prefix) will be printed. The default option is short.
> 
> since default is short, and its documented to exclude tag names, I
> would expect them to not be there. I also tried removing it to test
> but i saw no difference; tag names are still visible.

Are you reading that as "if short is specified, then refs whose names
are prefixed with refs/heads, refs/tags, etc will be omitted entirely
from decoration"?

The intent is "if short is specified, then a ref whose names has the
prefix of refs/heads, refs/tags, etc, will have that prefix removed when
showing it".

IOW, the options are:

  $ git log -1 --no-decorate | head -1
  commit 0bc85abb7aa9b24b093253018801a0fb43d01122

  $ git log -1 --decorate=short | head -1
  commit 0bc85abb7aa9b24b093253018801a0fb43d01122 (HEAD, tag: v1.9.2, origin/maint)

  $ git log -1 --decorate=full | head -1
  commit 0bc85abb7aa9b24b093253018801a0fb43d01122 (HEAD, tag: refs/tags/v1.9.2, refs/remotes/origin/maint)

If that's the confusion, feel free to suggest better wording for the
documentation.

-Peff

```

## Felipe Contreras, 2014-04-23 21:02

Subject: Re: How to trim the fat on my log graphs
Message-ID: <53582a537972f_24448772ec83@nysa.notmuch>
URL: https://gitlist.dev/e/53582a537972f_24448772ec83%40nysa.notmuch
In-Reply-To: <xmqqha5k0x8c.fsf@gitster.dls.corp.google.com>

```
Junio C Hamano wrote:
> Robert Dailey <rcdailey.lists@gmail.com> writes:
> 
> [Administrivia: because people read from top to bottom / why is it
> bad to top-post? / please do not top-post.]

https://en.wikipedia.org/wiki/Posting_style

-- 
Felipe Contreras

```
