Search code examples
gittig

Why do some git commits have "refs" when I look at them in Tig?


If I run "tig" on a git repo, I see that some commits have "refs" but some don't. The occurrence of "refs" seems random. I can not find a pattern. Sometimes merge commits have them, but sometimes they don't. Sometimes regular commits have them, but sometimes they don't.

So here is a merge that does not have "refs":

  commit 632647ebce1bf9c3f125635706a4d0ea34930837
  Merge: c98c7c3 399d871
  Author:     Tommmy
  AuthorDate: Tue Mar 8 17:01:34 2016 -0500
  Commit:     Tommy
  CommitDate: Tue Mar 8 17:01:34 2016 -0500

Here is a merge commit with "refs":

  commit 2f5d7ba2e6da74e612702267fecd5c55a3709bd2
  Refs: {origin/fogbugz-2159}
  Merge: 0294a42 4a4e27d
  Author:     Tommy
  AuthorDate: Wed Feb 24 10:00:27 2016 -0500
  Commit:     Tommy
  CommitDate: Wed Feb 24 10:00:27 2016 -0500

And likewise, with commits that are not merge commits, some have "refs" and some do not. What determines which has "refs"?


Solution

  • The Refs line contains the names of local and remote branches, tags, as well as the output of git describe unless the commit has been tagged.

    Formatting of the refs can be configured via reference-format:

    • [] are used for local branches, e.g. [master]
    • {} are used for remotes, eg. {origin/master}
    • <> are used for tags, e.g. <v1.1.0>