Gitql

一种 git 查询语言。(A git query language)

Github stars Tracking Chart

Gitql

Gitql 是一种 Git 查询语言。

在一个仓库路径...

how to use

查看更多

阅读代码

警告:本项目创建于2014年,是我的第一个 go 项目。使用这个项目来了解如何结构 go 代码不是一个好主意。你可以在这里阅读我的一个更现代的代码,或者帮我引导这个代码走向正确的方向。

项目要求

  • Go
  • cmake
  • pkg-config

如何安装

我们支持 linux 和 windows 平台(amd64)的静态编译,所以你可以访问发布页面并抓取二进制文件。如果你想自己编译,请按照下面的说明进行。

linux/amd64

阅读 docker 文件来了解整个过程。

darwin/amd64

我们还不支持静态编译。你需要有 pkg-config 作为依赖,所以在安装之后,运行

# 在这个仓库文件夹里
export PKG_CONFIG_PATH=${PWD}/libgit2/install/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
make build-dynamic

windows/amd64

你需要安装一个 C 编译器,Cmake 和 Ninja。使用 chocolately 应该很容易

choco install cmake ninja vcredist2017
set PATH=%HOMEDRIVE%\mingw64\bin;%PATH%
make build

你可以看看我们的github actions 文件,了解我们如何在 ci 服务器中构建它。如果即使在尝试了二进制文件或自己编译后,你也无法使用。打开一个问题。

例子

gitql "your query"

git ql "your query"

举个例子,这是提交表。

commits
author
author_email
committer
committer_email
hash
date
message
full_message

示例命令

  • select hash, author, message from commits limit 3
  • select hash, message from commits where 'hell' in full_message or 'Fuck' in full_message
  • select hash, message, author_email from commits where author = 'cloudson'
  • select date, message from commits where date < '2014-04-10'
  • select message from commits where 'hell' in message order by date asc

有疑问?

gitql 或打开一个问题

请注意:

  • Gitql不想杀死git日志--它只是为了科学而创建的!
  • 它是只读的,不能删除、插入、更新表或提交。
  • 默认限制为10行。
  • 它的灵感来自 textql
  • Gitql 是一个编译器/解释器,而不是仅仅读取一个包含所有提交、标签等的sqlite数据库,因为每次运行sql之前,我们都需要同步表,而且每个仓库都会有sqlite基础。


(The first version translated by vz on 2020.08.29)

Main metrics

Overview
Name With Ownerfilhodanuvem/gitql
Primary LanguageGo
Program languageGo (Language Count: 3)
PlatformDocker, Linux, Windows
License:MIT License
所有者活动
Created At2014-02-17 02:19:11
Pushed At2024-10-14 14:32:41
Last Commit At
Release Count22
Last Release Namev2.3.1 (Posted on )
First Release Name0.0.1 (Posted on 2014-04-09 10:25:53)
用户参与
Stargazers Count6.3k
Watchers Count93
Fork Count163
Commits Count318
Has Issues Enabled
Issues Count68
Issue Open Count4
Pull Requests Count108
Pull Requests Open Count6
Pull Requests Close Count36
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Gitql

Gitql is a Git query language.

In a repository path...

how to use

See more here

Requirements

  • Go
  • cmake
  • pkg-config

How to install

We support static compiling for linux and windows platform (amd64), so you can access the releases page and just grab the binary. If you want to compile itself follow the instructions below:

linux/amd64

Read the dockerfile to understand the whole process.

darwin/amd64

We do not support yet static compiling. You need to have pkg-config as dependencies, so after install that, run

# Inside this repository folder
export PKG_CONFIG_PATH=${PWD}/libgit2/install/lib/pkgconfig:/usr/local/opt/openssl/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$(PWD)/libgit2/install/lib
make build-dynamic

windows/amd64

You need a C compiler, Cmake and Ninja installed. Using chocolately it should be easy

choco install cmake ninja vcredist2017
set PATH=%HOMEDRIVE%\mingw64\bin;%PATH%
make build

You can always take a look in our github actions file to understand
how we build it in the ci server. If even after try the binaries or either compile yourself you couldn't use that. Open an issue.

Examples

gitql "your query"
or
git ql "your query"

As an example, this is the commits table: