Specific git-log output style

364 Views Asked by At

How can I use git log --pretty=format"" to output a git log in this format

timestamp|username|type|file    
1275543595|andrew|A|src/main.cpp
2

There are 2 best solutions below

0
On

Am i correct in assuming that you are trying to get this format so you can have gource parse it ?

if so, check out : https://github.com/whitewhidow/live-git-for-gource/blob/master/git-live.sh

wich already does this, also, just check the code, so you can figure out how to get the correct format, in case you needed it for something else ..

1
On

Crude, but gets the job done

git log --name-status --format='%ct|%an' hulu.sh |
  sed 'N;N;s/\n/|/;s///;s/\t/|/'
  • append 2 lines to pattern space
  • replace first newline with |
  • remove second newline
  • replace tab with |
1363415345|Steven Penny|M|hulu.sh
1363403048|Steven Penny|M|hulu.sh
1363278409|Steven Penny|M|hulu.sh
1363201389|Steven Penny|M|hulu.sh
1363158212|Steven Penny|M|hulu.sh

git log exclude renames