用过git,也用过sql。两者结合起来用有试过吗?github上开源了gitqlite项目
github地址:https://github.com/augmentable-dev/gitqlite。该项目使用sql语法可以做以下事情:
gitqlite “SELECT * FROM commits”
SELECT author_email, count(*) FROM commits GROUP BY author_email ORDER BY count(*) DESC
SELECT author_email, count(*) FROM commits WHERE parent_count < 2 GROUP BY author_email ORDER BY count(*) DESC
SELECT * FROM files WHERE commit_id='some_commit_id'
SELECT * FROM files WHERE commit_id LIKE 'shortened_commit_id%'
SELECT count(*) AS commits, SUM(additions) AS additions, SUM(deletions) AS deletions, author_email FROM commits GROUP BY author_email ORDER BY commits
SELECT count(*) AS commits, count(case when strftime('%w',author_when)='0' then 1 end) as sunday, count(case when strftime('%w',author_when)='1' then 1 end) as monday, count(case when strftime('%w',author_when)='2' then 1 end) as tuesday, count(case when strftime('%w',author_when)='3' then 1 end) as wednesday, count(case when strftime('%w',author_when)='4' then 1 end) as thursday, count(case when strftime('%w',author_when)='5' then 1 end) as friday, count(case when strftime('%w',author_when)='6' then 1 end) as saturday, author_email FROM commits GROUP BY author_email ORDER BY commits
那么怎么安装呢?首先该项目是个go程序,需要先安装go环境,并设置GOPATH变量
yum install go
export GOPATH=/data/mariolu/gopath(这里是填你的个人目录)
go get -v github.com/augmentable-dev/gitqlite
go install -v -tags=sqlite_vtable github.com/augmentable-dev/gitqlite
以后就可以愉快的使用gitqlite “sql语句”在git仓库目录下做历史提交的探索了。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。