Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a way to export the full commit history for all repositories in a CSV or TXT format?

I have a project with nearly 200 active repositories. I have been tasked with pulling the full commit history for all repositories. The resulting file will be audited by an accounting team. At minimum the information they are requesting is repository name, commit date, commit message, and person responsible but have stated that more information is better.

2 answers

1 accepted

2 votes
Answer accepted
Mike Corsaro Atlassian Team Jun 11, 2019

Hello! You can do this by running the git log command with custom parameters. To run it for all your repos you'll have to write a script to go through each folder and run this command:

git log --branches --tags --remotes --full-history --date-order --format='%ai %an <%ae> %h %f'


Note the --format part: this allows you to specify a custom output format for the log:

--format='%ai %an <%ae> %h %f'
%ai: author date
%an: author name
%ae: author email
%h: commit hash (small)
%f: commit subject (sanitized)


You can find more format strings on the git log manual page.

Is it possible to include the branch name in output?

Yeah, you can use the %d as part of the format string (it will add refs when it encounters a commit that has one), but be aware that each commit will not have the branch it is part of marked with the name.

This is because git doesn't actually know which commit a branch belongs to. It's confusing, but think of branches as a chain of commits where the name of the branch is just a pointer to the latest commit in the chain. So in order to figure out which commit is in a branch you'll need to "walk" all commits from your starting commit until you reach the latest commit which is the branch pointer reference.

0 votes

You can read this article that describes how to export commit and pull request data to CSV.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

7,147 views 5 13
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you