Git Health Check
This gem outputs a set of metrics for your Git repository which allows you to monitor its size over its lifetime.
Installation
Install the gem:
$ gem install git-health-check
Usage
Currently, the gem is best utilised as a post-build step and possibly outside of your push-triggered CI job depending on the size of your repository. Execution should take a couple of seconds for most people but for very large repositories with many thousands of commits - e.g. 1GB+ - it could take 10-15 minutes.
To perform a default run (the history threshold is set at 0.5MB):
$ ghc
To specify a threshold value (in MB) on the history reporting:
$ ghc -t 2
A report is generated at healthcheck/report.html
To view a list of available commands:
$ ghc -h
Usage: ghc [option]
Output metrics for your Git repository.
Examples:
ghc
ghc -t 10
ghc -t 0.2
Options:
-v, --version Displays the gem version
-h, --help Displays this help message
-t, --threshold THRESHOLD Specify history size threshold in MB (default 0.5)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
To Do:
- add timings
- add further CLI arguments (e.g.
-n
for number of results) - improve general logic - especially git_health_check_command.rb
- improve reporting - something better than ERB
- explore the use of Thor instead of OptionParser
- output number of commits -
git shortlog | grep -E '^[ ]+\w+' | wc -l
orgit log --pretty=format:'' | wc -l
- output total number of commits across all branches -
git rev-list --all | wc -l
- output contributors -
git shortlog | grep -E '^[^ ]'
orgit shortlog -n -s