Skip to content

Commit f885c26

Browse files
authored
Update README.md
1 parent febc945 commit f885c26

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

README.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
1-
# truegitcodechurn
2-
Python script to compute "true" code churn of a Git repository.
1+
# True Git Code Churn
2+
A Python script to compute "true" code churn of a Git repository. Especially useful for software teams.
3+
4+
Code churn has several definitions, the one that to me provides the most value as a metric is:
5+
6+
> "Code churn is when an engineer rewrites their own code in a short period of time."
7+
8+
*Reference: https://blog.gitprime.com/why-code-churn-matters/*
9+
10+
Solutions that I've found online looked at changes to files irrespective whether these are new changes or edits to existing files. Hence this solution that segments code edits with new code changes.
11+
12+
# How it works
13+
This script looks at a range of commits per author. For each commit it book-keeps the files that were changed along with the lines of code (LOC) for each file. LOC are kept in a sparse structure and changes per LOC are taken into account as the program loops. When a change to the same LOC is detected it updates this separately to bookkeep the true code churn.
14+
Result is a print with aggregated contribution and churn per author for a given time period.
15+
16+
Tested with Python version 3.5.3 and Git version 2.20.1
17+
18+
# Usage
19+
```bash
20+
python ./gitcodechurn.py --before=2019-03-01 --after=2018-11-29 --author="Some author" --dir=/Users/myname/myrepo
21+
```
22+
# Output
23+
```bash
24+
contribution: 844
25+
churn: -28
26+
```

0 commit comments

Comments
 (0)