Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,275
Community Members
 
Community Events
184
Community Groups

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
Atlassian Team members are employees working across the company in a wide variety of roles.
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?

Mike Corsaro
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Jul 18, 2019 • edited

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.

Hi, can we add the project name in that output file?

How can we add Jira ticket number in git log? Thanks!

@Scarlett Zhao the developers should be including this in the commit message - here's an output from the above command for a project which is linked to Jira

2022-10-19 11:29:18 -0400 Patrick Masters <pmasters@lazydays.com> 14c5a7a GRAPH-93-yml-and-config-tweaks
2022-10-19 11:00:45 -0400 Patrick Masters <pmasters@lazydays.com> 792d563 GRAPH-93-use-ControlReference-to-find-like-GL-items
2022-10-11 13:25:45 -0400 Patrick Masters <pmasters@lazydays.com> ae39371 GRAPH-88-added-versioning-and-editorconfig

 

0 votes
Irina Sanikovich [StiltSoft]
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
Aug 27, 2021

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
TAGS
AUG Leaders

Atlassian Community Events