Git Usage

Export GIT LOG into an CSV File

Go to your GIT repo folder –

In Linux, run

1
git log --oneline | tr "\r" " > ~/gitlog.csv

In Windows, run

1
git log --oneline > c:/temp/gitlog.csv

GIT also gives your the control on how to format the log output using pretty option, like below:

1
git log --pretty=format:%h,%an,%ae,%ad,%s

Note: --pretty and --oneline cannot be used at the same time.

This prints the log in the format of (hash [abbreviated], author name, author email, author date, subject)

To see the full list of format options: git help log

Some more samples:

1
git log --no-merges --since='mm-dd-yyyy' --pretty=format:%h,%an,%ae,%ad,%s > c:\dev\history.csv

You can also quote the values directly in the format -

1
git log --pretty=format:'"%h","%an","%ae","%ad","%s"' --date=iso-strict

so it’s clear when there’re commas in the memo