{"id":15728916,"url":"https://github.com/flaviostutz/gitwho","last_synced_at":"2025-05-13T10:41:22.263Z","repository":{"id":181523545,"uuid":"665518569","full_name":"flaviostutz/gitwho","owner":"flaviostutz","description":"Inspects a git repository and gives insights about developers around code ownership, churn, refactorings, new codes and people that help others.","archived":false,"fork":false,"pushed_at":"2023-12-18T10:25:34.000Z","size":709,"stargazers_count":6,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-20T23:32:36.985Z","etag":null,"topics":["engineering","git","quality","team"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flaviostutz.png","metadata":{"files":{"readme":"README.md","changelog":"changes.png","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-07-12T11:35:59.000Z","updated_at":"2025-02-27T09:19:42.000Z","dependencies_parsed_at":"2023-12-20T15:37:01.264Z","dependency_job_id":null,"html_url":"https://github.com/flaviostutz/gitwho","commit_stats":{"total_commits":135,"total_committers":4,"mean_commits":33.75,"dds":0.2592592592592593,"last_synced_commit":"859117f6015977ecda7405098f10895f7cf1a5df"},"previous_names":["flaviostutz/gitwho"],"tags_count":34,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviostutz%2Fgitwho","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviostutz%2Fgitwho/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviostutz%2Fgitwho/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviostutz%2Fgitwho/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flaviostutz","download_url":"https://codeload.github.com/flaviostutz/gitwho/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253891774,"owners_count":21979855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["engineering","git","quality","team"],"created_at":"2024-10-03T23:07:41.251Z","updated_at":"2025-05-13T10:41:22.221Z","avatar_url":"https://github.com/flaviostutz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitwho\n\nShows statistics about changed lines and line ownership per authors in a git repo. Take a look at the team or individual devs to understand better their behaviour and their evolution over time.\n\nThis utility gives you stats like:\n  - Changed lines per author over time classified in new, churn, helper or refactor (see concepts below)\n  - Files with most new, churn, helper or refactor changes\n  - Total owned lines of code per author in a moment in time\n  - Info about duplicated lines with file and line number indication\n  - You can always filter parts of the repo (file name regexes), branches or to a certain point in time in git history\n\n## Usage\n\n* We are distributing gitwho via npx/npx for now\n* Use `npx -y @gitwho/darwin-arm64@latest` for Mac M1\n* Use `npx -y @gitwho/darwin-amd64@latest` for older Macs\n* other options: @gitwho/linux-arm64, @gitwho/linux-amd64, @gitwho/windows-amd64\n\n```sh\nnpx -y @gitwho/darwin-arm64@latest ownership --help\nnpx -y @gitwho/darwin-arm64@latest changes --help\nnpx -y @gitwho/darwin-arm64@latest duplicates --help\n```\n\n### Example: show code ownership stats as of today\n```sh\nnpx -y @gitwho/darwin-arm64@latest ownership\n\nTotal authors: 2\nTotal files: 50\nAvg line age: 14 days\nDuplicated lines: 199 (5%)\nTotal lines: 3668\n  Flávio Stutz \u003cflaviostutz@gmail.com\u003e: 2718 (74.1%) avg-days:13 dup:157 orig:150 dup-others:8\n  Flavio Stutz \u003cflaviostutz@test.nl\u003e: 950 (25.9%) avg-days:18 dup:42 orig:34 dup-others:7\n```\n\n* When using \"--format graph\"\n\n\u003cimg src=\"ownership.png\" width=\"500\"\u003e\n\n### Example: show code ownership timeseries stats\n```sh\nnpx -y @gitwho/darwin-arm64@latest ownership-timeseries\n\nDate        Lines        Duplicates     Files       \n2023-06-10  6864         33368          656         \n2023-06-23  6864 (0)     33576 (+208)   658 (+2)    \n2023-07-07  6784 (-80)   34599 (+1023)  668 (+10)   \n2023-07-22  6780 (-4)    34945 (+346)   671 (+3)    \n2023-07-23  6832 (+52)   35603 (+658)   672 (+1)    \n2023-08-19  6820 (-12)   36758 (+1155)  674 (+2)    \n2023-09-01  6868 (+48)   37327 (+569)   677 (+3)    \nInc/period  4 (+0%)      3959 (+11%)    21 (+3%)  \n\nSebastiaan van Stijn\nDate        Lines          Duplicates (total)  Duplicates (original)  \n2023-06-10  16076          1120                1028                   \n2023-06-23  16135 (+59)    1132 (+12)          1044 (+16)             \n2023-07-07  17304 (+1169)  1148 (+16)          1060 (+16)             \n2023-07-22  17689 (+385)   1152 (+4)           1068 (+8)              \n2023-07-23  18345 (+656)   1212 (+60)          1128 (+60)             \n2023-08-19  20068 (+1723)  1260 (+48)          1168 (+40)             \n2023-09-01  20715 (+647)   1320 (+60)          1220 (+52)             \nInc/period  4639 (+28%)    200 (+17%)          192 (+18%)\n```\n\n* When using \"--format graph\"\n\n\u003cimg src=\"ownership-timeseries.png\" width=\"500\"\u003e\n\n\n### Example: Show changes stats for the last 30 days\n\n```sh\ncd myrepo\nnpx -y @gitwho/darwin-arm64@latest changes\n\nTotal authors active: 2\nTotal files touched: 69\nAverage line age when changed: 7 days\n- Total lines touched: 8739\n  - New lines: 6650 (76%)\n  - Changed lines: 2089 (23%)\n    - Refactor: 252 (12%)\n      - Refactor of own lines: 37 (14%)\n      - Refactor of other's lines: 215 (85%)\n      * Refactor done by others to own lines (help received): 215\n    - Churn: 1837 (87%)\n      - Churn of own lines: 1067 (58%)\n      - Churn of other's lines (help given): 770 (41%)\n      * Churn done by others to own lines (help received): 770\n\nAuthor: Flávio Stutz \u003cflaviostutz@gmail.com\u003e\n- Total lines touched: 6182 (70%)\n  - New lines: 4790 (77%)\n  - Changed lines: 1392 (22%)\n    - Refactor: 206 (14%)\n      - Refactor of own lines: 31 (15%)\n      - Refactor of other's lines: 175 (84%)\n      * Refactor done by others to own lines (help received): 40\n    - Churn: 1186 (85%)\n      - Churn of own lines: 870 (73%)\n      - Churn of other's lines (help given): 316 (26%)\n      * Churn done by others to own lines (help received): 454\n  - Top files:\n    - changes/analyser_worker.go (991)\n    - changes/analyser.go (610)\n    - utils/git_utils.go (395)\n    - Makefile (360)\n    - utils/duplicates.go (299)\n```\n\n* When using \"--format graph\"\n\n\u003cimg src=\"changes.png\" width=\"500\"\u003e\n\n### Example: Show duplicate lines\n\n```sh\nnpx -y @gitwho/darwin-arm64@latest duplicates\n\nDuplicated lines: 199 (5%)\nownership/analyser_test.go:18 - 22\n  ownership/formatter_test.go:45 - 49\n  ownership/formatter_test.go:28 - 32\n  ownership/formatter_test.go:11 - 15\n  ownership/analyser_test.go:46 - 49\n  ownership/analyser_test.go:127 - 129\n  ownership/analyser_test.go:106 - 108\n  ownership/analyser_test.go:80 - 82\n  changes/formatter_test.go:30 - 31\n  changes/formatter_test.go:14 - 15\nownership/analyser_test.go:104 - 108\n  ownership/analyser_test.go:125 - 129\n  ownership/analyser_test.go:46 - 48\n  ownership/analyser_test.go:19 - 21\n  ownership/formatter_test.go:46 - 48\n  ownership/formatter_test.go:29 - 31\n  ownership/formatter_test.go:12 - 14\n  ownership/analyser_test.go:80 - 81\n```\n\n### gitwho ownership\n\n* Gets the current situation of a repository in a moment in time and counts how many lines of code was created by whom by doing git blame in all files in the repo. For more info, check https://git-scm.com/docs/git-blame\n\n\n## Commands\n\n### gitwho ownership\n\n* Shows the current situation of the ownership of lines of code in repository per author. The author that last changed a certain line is considered the \"owner\" of the line of code.\n\n```sh\ngitwho ownership --help\nUsage of ownership:\n  -authors string\n        Regex for selecting which authors to include in analysis (default \".*\")\n  -authors-not string\n        Regex for filtering out authors from analysis\n  -branch string\n        Branch name to analyse (default \"main\")\n  -cache-file string\n        If defined, stores results in a cache file that can be used in subsequent calls that uses the same parameters.\n  -cache-ttl int\n        Time in seconds for old items in cache file to be deleted. Defaults to 2 months (default 5184000)\n  -files string\n        Regex for selecting which file paths to include in analysis (default \".*\")\n  -files-not string\n        Regex for filtering out files from analysis\n  -format string\n        Output format. 'full' (more details), 'short' (lines per author), 'graph' (open browser), or 'csv' (CSV format) (default \"full\")\n  -min-dup-lines int\n        Min number of similar lines in a row to be considered a duplicate (default 4)\n  -profile-file string\n        Profile file to dump golang runtime data to\n  -repo string\n        Repository path to analyse (default \".\")\n  -verbose\n        Show verbose logs during processing\n  -when string\n        Date to do analysis in repo (default \"now\")\n```\n\n### gitwho changes\n\n* Go through all the commits in a certain period and classify which kind of change was done to the lines changed. The final result is the sum of all changes, so for example, if the same line was touched in 4 commits, it will show as 4 lines changed in total. The idea is to show the running effort during coding.\n\n```sh\ngitwho changes --help\nUsage of changes:\n  -branch string\n        Regex for filtering changes by branch name (default \"main\")\n  -files string\n        Regex for filtering which files paths to analyse (default \".*\")\n  -files-not string\n        Regex for filtering out files from analysis\n  -format string\n        Output format. 'full' (all authors with details) or 'short' (top authors by change type) (default \"full\")\n  -profile-file string\n        Profile file to dump golang runtime data to\n  -repo string\n        Repository path to analyse (default \".\")\n  -since string\n        Filter changes made from this date (default \"30 days ago\")\n  -until string\n        Filter changes made util this date (default \"now\")\n  -verbose\n        Show verbose logs during processing (default true)\n```\n\n#### Types of change concept\n\nWhen a line is added or deleted by a commit, the context of the change will be analysed so we can classify it in:\n\n- *Code churn*\n  - Lines that were changed by the same dev multiple times in a very short period\n  - Might indicate code that is unstable, buggy or that gets pushed to repo too soon, before minimum quality\n\n- *Code help*\n  - Lines that were changed by a different dev multiple times in a very short period (\u003c= 21 days)\n  - Might indicate someone helping other devs to strive/meeting their goals by removing bugs, enhancing code from newly created features etc\n\n- *Code refactor*\n  - Lines that were changed after a while (\u003e 21 days)\n  - Might indicate code that was improved because of tech debt resolutions, continuous improvement behaviours or hard to tackle bugs found after the code was being used for a while\n\n- *New Code*\n  - New lines of code\n  - Might indicate new features being added or spikes being made\n\nSee more info in this excelent article: https://www.hatica.io/blog/code-churn-rate/\n\n### gitwho duplicates\n\n* Shows duplicate lines found among all the files in the repo. You can tweak the search to only consider a certain line as \"duplicate\" if more than one line is in a group of duplications (defaults to 4 lines)\n\n```sh\ngitwho duplicates --help\nUsage of ownership:\n  -branch string\n        Branch name to analyse (default \"main\")\n  -files string\n        Regex for selecting which file paths to include in analysis (default \".*\")\n  -files-not string\n        Regex for filtering out files from analysis\n  -format string\n        Output format. 'full' (show all file refs found) or 'short' (show a limited number of file refs) (default \"full\")\n  -profile-file string\n        Profile file to dump golang runtime data to\n  -repo string\n        Repository path to analyse (default \".\")\n  -verbose\n        Show verbose logs during processing (default true)\n  -when string\n        Date time to analyse (default \"now\")\n```\n\n## General options\n\nIn general, the commands allows filtering by time (since, until, period etc), authors and files, so you can tweak the queries to focus on specific areas to create insights by your own.\n\n## More examples\n\n* Show simple list of authors with most lines of code in markdown pages\n  * `gitwho ownership --branch main --files .md --format short`\n\n* Show ownership details of Golang source codes, excluding anything with \"vendor\" in its path as it was 1 year ago\n  * `gitwho ownership --branch master --files \".go$\" --files-not \"vendor\" --when \"1 year ago\" --format full`\n\n* Show the top authors that made changes to .ts files from 5 years ago to 3 years ago (during 2 years). It will display top coders, the ones with most new codes, most refactors and most churn\n  * `gitwho changes --branch main --files .ts --since \"5 years ago\" --until \"3 years ago\" --format short`\n\n* Show list of files along with other files that have duplicate contents between them for Go files. Only consider a duplicate if there is more than 4 lines in a row that is similar between files.\n  * `gitwho duplicates --branch main --files .go --format short --min-dup-lines 4`\n\n## Analysis details\n\n- Blank lines and a few common source code keywords, such as \"import\", \"export\", \"package\" etc are excluded from duplication analysis\n\n- For detecting line ownership, line age etc gitwho uses \"git blame\"\n\n- If you have the same author with multiple name/mail combinations in commits, use the file .mailmap so you can group results for the same person. For more info, see https://git-scm.com/docs/gitmailmap","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaviostutz%2Fgitwho","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaviostutz%2Fgitwho","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaviostutz%2Fgitwho/lists"}