Search code examples
gitazure-devopsreporting

Export list of all commit details in VSTS / Azure DevOps into file?


I want to export a list of all commits in a repository (date-time, author, comment) into a file (of any format: CSV, XML, JSON, XLS etc.) which I will then analyse in a spreadsheet.

I want to compute stats such as:

  • number of commits per author per month
  • size of each commit (number of lines & files changed, size in kB)
  • busiest times of day, busiest days of week, busiest months of year etc.

This is for a high-level management report so non-technical managers can understand the size of effort without blinding them with actual code & architecture details.

There seems to be no obvious way to do this. I find a few complicated ideas in Git command line documentation but none that yields this info. Admittedly I am not an expert in Git.

Does anyone know a simple easy way to get high-level per-commit info out of VSTS / Azure DevOps or Git command line?

Intuitively this should be really easy but so far I have to copy/paste each screenful of commits into a spreadsheet and build up the info in steps. Crazily manual process. But it's all viewable in the Azure Devops browser interface under Commits so why can't I export it all at once?

Surely I am not the only person on earth who wants to analyse commit activity in this way! But so far I can find nothing online.


Solution

  • Thanks to @Philippe for guiding to the answer:

    • launch MS-DOS command line in the .git subdirectory for the solution
    • issue command: git log --pretty=format:%h,%an,%aD,%s > ./GitLog.csv
    • wait for GitLog.csv file to appear and open in spreadsheet program

    Format option meanings:

    • %h = commit hash
    • %an = Author Name
    • %aD = commit date
    • %s = subject (comment of commit)

    See here for more: https://git-scm.com/docs/pretty-formats and https://devhints.io/git-log-format

    This solution doesn't give number of files or size of each commit, but it's a strong start.

    (Philippe if you can move your comment in a proper answer rather, I'll give you the credit for providing the answer)