{"id":22007754,"url":"https://github.com/rubberduck203/gitnstats","last_synced_at":"2025-05-05T23:23:25.092Z","repository":{"id":56162729,"uuid":"96660455","full_name":"rubberduck203/GitNStats","owner":"rubberduck203","description":"Cross Platform Git History Analyzer built on .Net Core","archived":false,"fork":false,"pushed_at":"2020-11-27T12:18:11.000Z","size":131,"stargazers_count":40,"open_issues_count":4,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-31T00:41:18.221Z","etag":null,"topics":["analysis","dotnetcore","git","libgit2sharp"],"latest_commit_sha":null,"homepage":"","language":"C#","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/rubberduck203.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-09T04:13:59.000Z","updated_at":"2025-02-04T19:14:46.000Z","dependencies_parsed_at":"2022-08-15T13:50:50.484Z","dependency_job_id":null,"html_url":"https://github.com/rubberduck203/GitNStats","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubberduck203%2FGitNStats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubberduck203%2FGitNStats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubberduck203%2FGitNStats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rubberduck203%2FGitNStats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rubberduck203","download_url":"https://codeload.github.com/rubberduck203/GitNStats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252591326,"owners_count":21773069,"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":["analysis","dotnetcore","git","libgit2sharp"],"created_at":"2024-11-30T01:29:10.977Z","updated_at":"2025-05-05T23:23:25.071Z","avatar_url":"https://github.com/rubberduck203.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitNStats\n\nCommand line utility that reports back statistics about a git repository.\n\nThere are many tools out there, but most of them are interested in commits per author and other such things.\nGitNStats is an experiment in analyzing how often particular files in a repositor change (and how big those changes were).\nThe idea is to discover \"hotspots\" in a code base by determining which files have a lot of churn.\n\n[![Build status](https://ci.appveyor.com/api/projects/status/5ncbrrsob8t44bc5/branch/master?svg=true)](https://ci.appveyor.com/project/Rubberduck/gitnstats/branch/master)\n[![codecov](https://codecov.io/gh/rubberduck203/GitNStats/branch/master/graph/badge.svg)](https://codecov.io/gh/rubberduck203/GitNStats)\n\n## Quickstart\n\n```bash\ncd path/to/repo\ngitnstats\n```\n\nFor usage instruction run:\n\n```bash\n dotnet run --project src/gitnstats/gitnstats.csproj -- --help\n\n# or if you have a pre-packaged binary\n\ngitnstats --help\n```\n\n### Philosophy\n\nGitNStats tries to follow [the Unix philosophy](https://en.wikipedia.org/wiki/Unix_philosophy).\n\n - Make each program do one thing well.\n - Expect the output of every program to become the input to another, as yet unknown, program.\n\nThis means I've tried to stay light on the options and other bells and whistles.\n\n### Options\n\n#### Date Filter\n\nThe following command will return all a count of the number of times each file was committed on or after July 14th, 2017 on the develop branch.\n\n```bash\ngitnstats path/to/repo -b develop -d 2017-07-14\n```\n\n#### QuietMode\n\nBy default, GitNStats will print repository and branch information along with the history analysis.\nHowever, this can be awkward when piping output into another program, like `sort` for further processing.\nThis extra info and column headers can be suppressed with the `-q` switch.\n\n```bash\ngitnstats -q | sort\n```\n\n### Common Operations\n\nI've tried to provide instructions for common use cases below, but as tools differ from OS to OS,\nI've not tested that they work everywhere.\nIf something doesn't work on your OS of choice, please open a pull request.\nI don't have a Windows machine at the moment, so equivalent batch and powershell command would be appreciated.\n\n#### Saving to file\n\nShould work on basically every OS I know of, including Windows.\n\n```bash\ngitnstats \u003e filename.txt\n```\n\n#### Sorting\n\nOutput is sorted ascending by default.\n\nDescending:\n\n```bash\ngitnstats -q | sort -n\n```\n\nAscending without headers \u0026 branch info:\n\n```bash\ngitnstats -q | sort -nr\n```\n\n#### Display Top N Files\n\nDisplay the 10 most changed files:\n\n```bash\ngitnstats -q | sort -nr | head -n10\n```\n\nDisplay the 20 least changed files:\n\n```bash\ngitnstats -q | sort -nr | tail -n20\n```\n\n#### Display Only Files with More than N Commits\n\nYou can use awk to filter results.\nThe following command will print only records where the first column (the number of commits)\nis greater than or equal to 15.\n\n```bash\ngitnstats -q | awk '$1 \u003e= 15'\n```\n\n#### Filtering\n\nDisplay files with a specific file extension:\n\n```bash\ngitnstats | grep \\\\.cs$\n```\n\n`$` indicates end of line.\nThe `.` must be escaped with a `\\`, but since the shell uses the `\\` character as a line continuation, we must escape it as well.\n\nFilter on a directory:\n\n```bash\ngitnstats | grep tests/\n```\n\n## Installation\n\nObtain the [latest release](https://github.com/rubberduck203/GitNStats/releases/latest).\n\nUnzip the distribution into your target directory.\nThe program can be run from this location, added to your PATH, \nor symbolic linked to a location that is already on your PATH.\n\nSymoblic linking to a location already on the PATH (like `/usr/local/bin/`) is recommended as it keeps your path clean.\n\n```bash\n# Download release (replace version and runtime accordingly)\ncd ~/Downloads\nwget https://github.com/rubberduck203/GitNStats/releases/download/2.3.1/osx-x64.zip\n\n# Create directory to keep package\nmkdir -p ~/bin/gitnstats\n\n# unzip\nunzip osx-x64.zip -d ~/bin/gitnstats\n\n# Create symlink\nln -s /Users/rubberduck/bin/gitnstats/gitnstats /usr/local/bin/gitnstats\n```\n\nAlternatively, you may want to keep the executable in the `/usr/local/share/` directory.\n\n### .Net Dependencies\n\nThis project uses \"self-contained\" .Net Core deployment.\n\"Self contained\" is quoted because although the *.zip archive includes the .Net runtime,\nthe .Net runtime has dependencies of it's own that need to be available.\nPlease see the [list of .Net Core runtime dependencies.][dotnet-deps] and make sure they're installed first. \n\n[dotnet-deps]: https://github.com/dotnet/core/blob/master/Documentation/prereqs.md\n\n## Build\n\n```bash\ndotnet restore\ndotnet build\n```\n\n## Tests\n\nIf you're using VS Code, there's a test task.\nCmd + P -\u003e `\u003e Tasks: Run Test Task`\n\nOtherwise...\n\n```bash\ndotnet test\n```\n\n### Code Coverage\n\nIf you use the `./test.sh` or `test w/ coverage` Task Runner in VSCode, you can generate lcov reports and use the [lcov extension](https://marketplace.visualstudio.com/items?itemName=alexdima.vscode-lcov) to view the code coverage.\n\n[Coverage Gutters](https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters) will work too, but you need to tell it to look for the right file name.\n\n## Publish\n\nTo maintain compatibility with our build server, we use 7zip to create the archive.\n\n```bash\nbrew install p7zip\n```\n\nThe publish script will package and zip a stand alone executable for each runtime specified in the *.csproj.\n\n```bash\n./publish.sh\n```\n\n### Integration Tests\n\nThe integration tests have two purposes.\n\n1. Verify the self-contained publish works properly for an OS.\n2. Document the .Net runtime dependencies for that OS.\n\nIf the tests is successful, you'll see output from the application and a get successful return code of 0.\nAll of the dockerfiles assume you have already run the `publish.sh` script. \n\n#### Ubuntu 14.04\n\n```bash\ndocker build -f src/ubuntu14.dockerfile -t rubberduck/gitnstats:ubuntu14 src\ndocker run rubberduck/gitnstats:ubuntu14\n```\n\n#### Ubuntu 16.04\n\n```bash\ndocker build -f src/ubuntu16.dockerfile -t rubberduck/gitnstats:ubuntu16 src\ndocker run rubberduck/gitnstats:ubuntu16\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubberduck203%2Fgitnstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubberduck203%2Fgitnstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubberduck203%2Fgitnstats/lists"}