TLD
TLD

Reputation: 8135

Some tricks for Git log

I have to analyze a git repository. Thus I want to ask that is there any command in git that can do following things:

  1. Calculate number of commit times of each author/committer in a specific directory
  2. From past to present, average number of files and type of file that developers have in a specific directory?

Upvotes: 2

Views: 454

Answers (1)

patthoyts
patthoyts

Reputation: 33203

  1. git shortlog -sn -- FolderName
  2. Not sure what you mean here - 'Average number of files'? On a per commit basis - git log --stat can show that files were touched in each commit. Maybe some parsed version of that is what you mean. If you are after examining code churn by user this is the way to go. For instance, the following will create a file that has one line per commit with who did it and how many lines and files were changed. You can then process this to produce graphs.

#!/bin/bash
for id in $(git rev-list HEAD)
do
    git log -n 1 --shortstat --format='%h %at %ae' $id | paste - - - -
done

Upvotes: 3

Related Questions