Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
Copy link

pwenzel commented Jun 6, 2012

Copy link

thanks! just what I needed

Copy link

pimpin commented Apr 24, 2014

and if you had to do it for severals repo :

# for each repo
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > ~/commits.local-<REPO_NAME>.tsv.txt
# then to have them in a single file :
cat ~/commits.local-* > ~/all-repos-commits.tsv.txt

Copy link

wolph commented Aug 18, 2015

Or for csv (which opens correctly in Excel): git log --date=iso --pretty=format:'"%h","%an","%ad","%s"'

Copy link

Nice one cheers! 🍻

Copy link

Is there a way to save this into a folder outside of the local git folder?

Copy link

greeneca commented Dec 4, 2017

@shahzebjiwani You can have the output directed to where ever you want you just have to put the correct file path in.

For one directory up you could do :
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > ../commits.local.tsv.txt

For an arbitary location, you just have to use an absolute path (home directory):
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > /home/username/commits.local.tsv.txt

Copy link

zigmoo commented Dec 8, 2022

Or for csv (which opens correctly in Excel): git log --date=iso --pretty=format:'"%h","%an","%ad","%s"'

I especially like this one!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment