{"id":15529369,"url":"https://github.com/mnapoli/gitstats","last_synced_at":"2025-08-26T14:13:07.267Z","repository":{"id":57018491,"uuid":"72996700","full_name":"mnapoli/gitstats","owner":"mnapoli","description":"Iterate through git commits to gather statistics","archived":false,"fork":false,"pushed_at":"2018-01-14T10:15:21.000Z","size":36,"stargazers_count":10,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T23:51:07.237Z","etag":null,"topics":["git","statistics"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/mnapoli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-06T14:39:56.000Z","updated_at":"2022-06-30T10:09:03.000Z","dependencies_parsed_at":"2022-08-22T12:00:25.613Z","dependency_job_id":null,"html_url":"https://github.com/mnapoli/gitstats","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnapoli%2Fgitstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnapoli%2Fgitstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnapoli%2Fgitstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mnapoli%2Fgitstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mnapoli","download_url":"https://codeload.github.com/mnapoli/gitstats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250438519,"owners_count":21430812,"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":["git","statistics"],"created_at":"2024-10-02T11:17:36.329Z","updated_at":"2025-04-23T12:52:52.756Z","avatar_url":"https://github.com/mnapoli.png","language":"PHP","readme":"# Iterate through git commits to gather statistics\n\n## Installation\n\n- clone this repository\n- install Composer dependencies\n- symlink the `gitstats` to your `/usr/local/bin`: `ln -s /home/\u003cyou\u003e/code/gitstats/gitstats /usr/local/bin/gitstats`\n\nAlternatively you can install the Composer package globally (`composer global require mnapoli/gitstats`)\n\n## Usage\n\n- Add a `.gitstats.yml` file in your current directory:\n\n```yaml\ntasks:\n    'Commit message': \"git log -1 --pretty=%B | head -n 1\"\n    'Commit author': \"git log -1 --pretty=%an\"\n    'Number of files': \"find . -type f | wc -l | xargs\"\n    'Number of directories': \"find . -type d | wc -l | xargs\"\n```\n\n- Run the application:\n\n```shell\n$ gitstats run \u003cgit-repository-url\u003e\n```\n\nThe repository will be cloned in a temporary directory. All tasks will be run against each commit. Ensure the repository doesn't contain modifications.\n\nThe output is formatted as CSV:\n\n```csv\nCommit,Date,Number of files,Number of directories\nd612a29fae3b0f625b9be819802e93214d4eecd9,2016-08-31T12:55:38+02:00,61,28\n497f22a27896d146a35660f452eba24d3a14db3f,2016-08-31T12:53:01+02:00,61,28\nfc0646f236e6bb0a10b14a67424f932f28eb1062,2016-08-26T19:29:40+02:00,62,28\n221528e63d7aac3aa247dfde191b5f6c380cbb7e,2016-08-25T01:28:55+02:00,62,28\n...\n```\n\nYou can write the output to a file:\n\n```shell\n$ gitstats run \u003cgit-repository-url\u003e \u003e results.csv\n```\n\nYou can then import that into a database or open it up with Excel or whatever.\n\n### MySQL\n\nYou can output the result as SQL queries to insert/update a MySQL table:\n\n```shell\n$ gitstats run \u003cgit-repository-url\u003e --format=sql | mysql -u \u003cuser\u003e -p \u003ctable\u003e\n```\n\n### Limit the number of commits processed\n\nYou can limit the number of commits to process using the `--max` parameter:\n\n```shell\n# Process only 100 commits\n$ gitstats run \u003cgit-repository-url\u003e --max=100\n```\n\n### Show the progress\n\nYou can show a progress bar on stderr using the `--progress` parameter. When using that parameter it makes sense to redirect the output to a file or another command:\n\n```shell\n$ gitstats run \u003cgit-repository-url\u003e --progress \u003e file.csv\n```\n\n![](https://i.imgur.com/zoKRker.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnapoli%2Fgitstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmnapoli%2Fgitstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmnapoli%2Fgitstats/lists"}