Git/log: Difference between revisions

No edit summary
simplify with format= syntax
Line 226: Line 226:


<br>
<br>
<code>git log -3 --pretty=format:"* %h - %an: %s" 39.5.0...HEAD</code>
<code>git log -3 --format="* %h - %an: %s" 39.5.0...HEAD</code>
gives output like this:
gives output like this:
<pre>
<pre>
Line 235: Line 235:


Show the date in 'short' format -in other words YYYY-MM-DD - with '''<tt>%as</tt>'''<br>
Show the date in 'short' format -in other words YYYY-MM-DD - with '''<tt>%as</tt>'''<br>
<code>git log -3 --pretty=format:"* %h (%as) - %an: %s" 39.5.0...HEAD</code>
<code>git log -3 --format="* %h (%as) - %an: %s" 39.5.0...HEAD</code>
<pre>
<pre>
* 43be9737 (2025-08-17) - Greg Rundlett: Make wiki config directory group executable
* 43be9737 (2025-08-17) - Greg Rundlett: Make wiki config directory group executable
Line 244: Line 244:


Add in ref names (tags / branches) with '''<tt>%d</tt>''' (which stands for decorations)<br>
Add in ref names (tags / branches) with '''<tt>%d</tt>''' (which stands for decorations)<br>
<code>git log -3 --pretty=format:"* %h (%as) %d - %an: %s" 39.5.0...HEAD</code>
<code>git log -3 --format="* %h (%as) %d - %an: %s" 39.5.0...HEAD</code>
<pre>
<pre>
* 43be9737 (2025-08-17)  (HEAD -> main, tag: 43.25.11, origin/main, origin/HEAD) - Greg Rundlett: Make wiki config directory group executable
* 43be9737 (2025-08-17)  (HEAD -> main, tag: 43.25.11, origin/main, origin/HEAD) - Greg Rundlett: Make wiki config directory group executable
Line 252: Line 252:


Instead of the default decorations for ref names you get with a simple '''<tt>%d</tt>''', you can supply your own. Here we prefix tags with '''v''' and no space instead of the default 'tag: ' seen above. To use long-hand decoration, you specify '''<tt>%(decorate:)</tt>''' along with four specifications for the prefix, suffix, tag and separator. E.g.<br>
Instead of the default decorations for ref names you get with a simple '''<tt>%d</tt>''', you can supply your own. Here we prefix tags with '''v''' and no space instead of the default 'tag: ' seen above. To use long-hand decoration, you specify '''<tt>%(decorate:)</tt>''' along with four specifications for the prefix, suffix, tag and separator. E.g.<br>
<code>git log -3 --pretty=format:"* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s" 39.5.0...HEAD</code>
<code>git log -3 --format="* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s" 39.5.0...HEAD</code>
<pre>
<pre>
* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable
* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable
Line 260: Line 260:


Just like '''%s''' shows the '''subject''', '''<tt>%b</tt>''' shows the '''body''' of the commit message in the log.<br>
Just like '''%s''' shows the '''subject''', '''<tt>%b</tt>''' shows the '''body''' of the commit message in the log.<br>
<code>git log -3 --pretty=format:"* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s %b" 39.5.0...HEAD</code>
<code>git log -3 --format="* %h (%as) %(decorate:prefix=,suffix=,tag=v,separator= ) - %an: %s %b" 39.5.0...HEAD</code>
<pre>
<pre>
* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable Not sure this should be apache owned, but if meza-ansible
* 43be9737 (2025-08-17) HEAD -> main v43.25.11 origin/main origin/HEAD - Greg Rundlett: Make wiki config directory group executable Not sure this should be apache owned, but if meza-ansible