Skip to content

Instantly share code, notes, and snippets.

@RyanMagnusson
Forked from pwenzel/git-log-to-tsv.sh
Last active November 18, 2015 17:59
Show Gist options
  • Save RyanMagnusson/209bd58ff691314f43d2 to your computer and use it in GitHub Desktop.
Save RyanMagnusson/209bd58ff691314f43d2 to your computer and use it in GitHub Desktop.
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

#Pretty Format of Git Log

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

For multiple Repos:

  1. For each repository run:

    git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s%x09${REPO_NAME}" > ~/commits.local-<REPO_NAME>.tsv.txt
  2. Merge the results together into a single file

    cat ~/commits.local-* > ~/all-repos-commits.tsv.txt

CSV Format for Excel

git log --date=iso --pretty=format:'"%h","%an","%ad","%s"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment