Home > Enterprise >  How can I list all branches with dates and hashes?
How can I list all branches with dates and hashes?

Time:01-21

How do I get a list of all branches with names, dates and hashes?

I can get a list with the names and dates by

git branch -r --format='%(refname:short) %(committerdate:short)'

What can I add to the command to include the commit hashes?

Adding %H does not work, I already tried it.

CodePudding user response:

According to git help git-for-each-ref (to which git help branch refers you), you are looking for objectname:

objectname
    The object name (aka SHA-1). For a non-ambiguous abbreviation of
    the object name append :short. For an abbreviation of the object
    name with desired length append :short=<length>, where the minimum
    length is MINIMUM_ABBREV. The length may be exceeded to ensure
    unique object names.
  •  Tags:  
  • git
  • Related