1

We were using the git-flow branching model during a project. So I want to do a quick analysis which features took the most afford to complete.

I want some statistics about which feature branch had the most changes, the most commits before beeing merged into the main branch.

All git analysis tools I tried so far don't have these kind of metrics. Any ideas how to get these metrics?

Thanks so far.

A.S.
  • 4,574
  • 3
  • 26
  • 43

1 Answers1

2

For each branch you would like to discover the base commit (ie. when exactly the branch was created). Using solution from this answer:

branch='feature/foo'
base=$(diff -u <(git rev-list --first-parent $branch) \
             <(git rev-list --first-parent master) | \
     sed -ne 's/^ //p' | head -1)

Now, depending on what exactly you want to see you have a couple of options:

# Number of non-merge commits in the branch
git log --oneline --no-merges $base..$branch | wc -l

# Summary or detailed stats (changed files, added/removed lines)
git diff --shortstat $base $branch
git diff --stat $base $branch
Kombajn zbożowy
  • 8,755
  • 3
  • 28
  • 60