gitstats
Generate statistics from a Git repository
TLDR
Generate statistics for a local repository
View generated statistics in a web browser on Windows (PowerShell)/macOS/Linux
SYNOPSIS
gitstats [options] repository_path [output_path]
PARAMETERS
repository_path
The path to the git repository to analyze. This is a required argument.
output_path
The path to the directory where the generated HTML report will be saved. If omitted, a directory named 'gitstats' is created.
--help
Display help message.
--version
Display version information.
--stylesheet
Specify a custom stylesheet to use for the generated HTML.
--template
Specify a custom template directory to use for the generated HTML.
--log
Specify a log file to write debugging information to.
--no-html
Do not generate an HTML report.
--commit-limit
Limit the number of commits to process.
--cache
Enable caching to improve performance on subsequent runs.
--no-cache
Disable caching.
--starting-commit
Start processing commits from the specified commit.
--until
Analyze commits until the given date.
--author
Only analyze commits from authors matching the given pattern.
--exclude
Exclude commits matching the given pattern.
--ignore-space-change
Ignore changes in amount of white space. This option invokes -b of git-diff[1].
--ignore-all-space
Ignore white space when comparing lines. This option invokes -w of git-diff[1].
--ignore-blank-lines
Ignore changes whose lines are all blank. This option invokes -B of git-diff[1].
DESCRIPTION
Gitstats analyzes a git repository and generates detailed HTML reports visualizing various aspects of the project's history. This includes commit activity over time (commits per hour, day, week, month, year), author contributions, file type distributions, line count changes, and more. The reports provide valuable insights into the project's development patterns, team dynamics, and overall health. It parses the git log using standard `git log` commands and then generates a static website with interactive charts (using javascript libraries). The primary output is an `index.html` file within the designated output directory, which can then be served by a web server or viewed locally. Gitstats doesn't alter the git repository itself; it only reads the existing commit history.It is very important to not run gitstats directly inside your repository because all generated files will be committed. Create a directory outside your git directory.
CAVEATS
Gitstats relies on the 'git log' command, so its accuracy depends on the completeness and correctness of the git history. Large repositories with extensive histories can take a considerable amount of time and resources to analyze. It's best to run gitstats outside the repository directory to avoid accidentally committing the generated files. The javascript library is sometimes outdated.
USAGE EXAMPLE
gitstats /path/to/my/repository /path/to/output
This will analyze the repository at '/path/to/my/repository' and generate an HTML report in the '/path/to/output' directory.
CUSTOMIZATION
Gitstats can be customized using custom stylesheets and templates. This allows you to tailor the appearance and content of the generated reports to match your specific needs.
HISTORY
Gitstats was created to provide a visual overview of git repository activity. Over time, it has been enhanced with various options to filter commits, customize the output, and improve performance. It continues to be maintained and used as a helpful tool for understanding software development project trends.