'Analysing the complexity of a git repository's history
I am sure most developers are familiar with cyclomatic complexity which is used to indicate the complexity of code.
I was wondering if there is a tool that analyses the complexity of git history. Not the actual code or commits themselves but how the commit graph looks.
Something like having a "clean" history would give a low score and having a complex history would give a high score.
Any ideas if this exists?
Solution 1:[1]
A simple solution could be to get all your branches, generate all combination of two branches, and for each couple test if one branch is contained into the other (git branch --contains). If that is the case, then you can increment a counter. At the end, you can provide a score, that would be the counter divided by the number of combination:
- A score close to 100% likely means that all your branches are merged one into the other
- A score closes to 50% means that all your branches are probably all merged into master
- A score of 0% means that your changes are systematically rebased (or that all your branches are un active).
This is quiet limited, but there is a code sample here on Github with an example of how to integrate it into your repo.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hugo Zevetel |
