Skip to content

Instantly share code, notes, and snippets.

Embed
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
@pwenzel
Copy link
Author

pwenzel commented Jun 6, 2012

@larsberg
Copy link

larsberg commented Dec 16, 2013

thanks! just what I needed

@pimpin
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

@WoLpH
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"'

@lacostenycoder
Copy link

lacostenycoder commented Aug 25, 2016

Nice one cheers! 🍻

@shahzebjiwani
Copy link

shahzebjiwani commented Nov 18, 2017

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

@greeneca
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

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