$ 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