Reputation: 4574
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.
Upvotes: 1
Views: 388
Reputation: 10693
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
Upvotes: 2