$ git-stats本地GIT统计数据,包括类似GitHub的贡献日历。
我很想看到您的日历所有的提交。在Twitter( @ionicabizau )上ping我。 ?在此之前,这是我的日历:
安装
用法
文档
如何贡献
您可以在全球安装软件包,并将其用作命令行工具:
# Install the package globally
npm i -g git-stats
# Initialize git hooks
# This is for tracking the new commits
curl -s https://raw.githubusercontent.com/IonicaBizau/git-stats/master/scripts/init-git-post-commit | bash然后,运行git-stats --help看看CLI工具可以做什么。
$ git-stats --help
Usage: git-stats [options]
Local git statistics including GitHub-like contributions calendars.
Options:
-r, --raw Outputs a dump of the raw JSON data.
-g, --global-activity Shows global activity calendar in the current
repository.
-d, --data <path> Sets a custom data store file.
-l, --light Enables the light theme.
-n, --disable-ansi Forces the tool not to use ANSI styles.
-A, --author Filter author related contributions in the current
repository.
-a, --authors Shows a pie chart with the author related
contributions in the current repository.
-u, --until <date> Optional end date.
-s, --since <date> Optional start date.
--record <data> Records a new commit. Don't use this unless you are
a mad scientist. If you are a developer just use
this option as part of the module.
-h, --help Displays this help.
-v, --version Displays version information.
Examples:
$ git-stats # Default behavior (stats in the last year)
$ git-stats -l # Light mode
$ git-stats -s '1 January, 2012' # All the commits from 1 January 2012 to now
$ git-stats -s '1 January, 2012' -u '31 December, 2012' # All the commits from 2012
Your commit history is kept in ~/.git-stats by default. You can create
~/.git-stats-config.js to specify different defaults.
Documentation can be found at https://github.com/IonicaBizau/git-stats.
我知道从头开始启动您的git提交日历是不好的。这就是为什么我创建git-stats-importer原因 - 一种工具,该工具可从选定的存储库中导入或删除承诺的原因。
在此处查看:https://github.com/ionicabizau/git-stats-importer
用法很简单:
# Install the importer tool
$ npm install -g git-stats-importer
# Go to the repository you want to import
$ cd path/to/my-repository
# Import the commits
$ git-stats-importer
# ...or delete them if that's a dummy repository
$ git-stats-importer --delete是的,这也是可能的。我构建了一个工具,该工具可下载,然后导入您推向GitHub和Bitbucket的所有提交!
# Download the repository downloader
$ git clone https://github.com/IonicaBizau/repository-downloader.git
# Go to repository downloader
$ cd repository-downloader
# Install the dependencies
$ npm install
# Start downloading and importing
$ ./start如果您想可视化GITHUB配置文件上出现的日历,则可以使用ghcal执行此操作。
# Install ghcal
$ npm install -g ghcal
# Check out @alysonla's contributions
$ ghcal -u alysonla有关更详细的文档,请查看存储库:https://github.com/ionicabizau/ghcal。
如果想在终端中获得更多的GitHub统计数据,您可能想尝试使用github-stats - 就像git-stats一样,但带有从GitHub获取的数据。
您可以使用主目录中的配置文件来调整git-stats的行为: ~/.git-stats-config.js 。
该文件应导出一个对象,如下(列出了默认值):
module . exports = {
// "DARK", "LIGHT" or an object interpreted by IonicaBizau/node-git-stats-colors
"theme" : "DARK"
// The file where the commit hashes will be stored
, "path" : "~/.git-stats"
// [DEPRECATED] First day of the week https://github.com/IonicaBizau/git-stats/issues/121
, first_day : "Sun"
// This defaults to *one year ago*
// It can be any parsable date
, since : undefined
// This defaults to *now*
// It can be any parsable date
, until : undefined
// Don't show authors by default
// If true, this will enable the authors pie
, authors : false
// No global activity by default
// If true, this will enable the global activity calendar in the current project
, global_activity : false
} ;由于它是JS文件,因此您可以在那里require任何其他模块。
git-stats --raw输出RAW JSON格式,该格式可以用其他工具消耗以生成诸如HTML文件或图像之类的结果。
git-stats-html解释JSON数据并生成HTML文件。例子:
# Install git-stats-html
npm install -g git-stats-html
# Export the data from the last year (generate out.html)
git-stats --raw | git-stats-html -o out.html
# Export data since 2015 (save the results in out.html)
git-stats --since ' 1 January 2015 ' --raw | ./bin/git-stats-html -o out.html --big
拥有HTML文件后,我们可以使用@sindresorhus的pageres来生成一个图像文件:
# Install pageres
npm install -g pageres-cli
# Generate the image from HTML
pageres out.html 775x250
git-stats在支持ANSI样式的终端模拟器中工作良好。它应该在Linux和OS X上正常工作。
如果您运行git-stats在Windows上显示图形,请使用可以正确显示ANSI颜色的终端。
众所周知,Cygwin终端可以工作,而Windows命令提示符和Git Bash却没有。改进非常欢迎! ?
这是如何将此软件包用作库的示例。要在本地安装它作为库,您可以使用npm install git-stats (或yarn add git-stats ):
// Dependencies
var GitStats = require ( "git-stats" ) ;
// Create the GitStats instance
var g1 = new GitStats ( ) ;
// Display the ansi calendar
g1 . ansiCalendar ( {
theme : "DARK"
} , function ( err , data ) {
console . log ( err || data ) ;
} ) ; 有几种获得帮助的方法:
有关完整的API参考,请参见documentation.md文件。
有一个主意吗?找到一个错误?看看如何贡献。
我几乎可以为所有能力开放源,然后尝试回复每个需要使用这些项目帮助的人。显然,这需要时间。您可以免费将这些项目集成并使用这些项目!您甚至可以更改源代码并重新分发(甚至转售)。
但是,如果您从中获得一些盈利,或者只是想鼓励我继续创建东西,那么您几乎可以做到这一点:
主演和分享您喜欢的项目
- 我爱书!如果您给我买了一个,我会记得您。 ?
- 您可以通过PayPal进行一次性捐款。我可能会买咖啡茶。 ?
- 设置一个经常出现的每月捐款,您将获得有关我在做什么的有趣消息(我不与所有人分享的事情)。
比特币- 您可以在此地址向我发送比特币(或扫描下面的代码): 1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6
谢谢! ❤️
如果您在一个项目中使用此库,请在此列表中添加。
git-stats-importergit-stats-fcc-importer麻省理工学院©离子Bizău