We have some people with long names in our git commit logs. Currently, my format is
pretty = %C(yellow)%h%Creset %s %C(red)(%an, %cr)%Creset
which shows
276840c Kyle Heironimus Added updated hello world example. (3 months ago)
I really just want
276840c Kyle Added updated hello world example. (3 months ago)
If I can't just take the first word of the author name, the first 5 characters would be my second choice.
Any way to do this?
A simple fix is to pass the --pretty=oneline parameter, which makes it all fit on a single line. It's taking up less space, but missing crucial information like the date of the commit. There are longer versions of that same --pretty parameter. In fact, it allows you to specify all the fields you want in the output.
Pretty-print the contents of the commit logs in a given format, where <format> can be one of oneline, short, medium, full, fuller, reference, email, raw, format:<string> and tformat:<string>.
Git Log Oneline The oneline option is used to display the output as one commit per line. It also shows the output in brief like the first seven characters of the commit SHA and the commit message. It will be used as follows: $ git log --oneline.
The --decorate flag makes git log display all of the references (e.g., branches, tags, etc) that point to each commit. This lets you know that the top commit is also checked out (denoted by HEAD ) and that it is also the tip of the main branch.
If you use %aN rather than %an, Git will consider aliases listed in ~/.mailmap when displaying author names. If you create that file, and add, say -
Kyle <[email protected]>
then you should get the desired output.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With