Skip to content

Instantly share code, notes, and snippets.

Created June 6, 2012 20:53
  • Star 70 You must be signed in to star a gist
  • Fork 22 You must be signed in to fork a gist
Star You must be signed in to star a gist
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

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