git-query

git data extraction tool using c and libgit2

git clone https://9o.is/git/git-query.git

git-query.1

(1788B)


      1 .Dd March 2, 2026
      2 .Dt GIT-QUERY 1
      3 .Os
      4 .Sh NAME
      5 .Nm git-query
      6 .Nd git data extraction tool
      7 .Sh SYNOPSIS
      8 .Nm
      9 .Ar command
     10 .Ar repo
     11 .Op Ar args...
     12 .Sh DESCRIPTION
     13 .Nm
     14 is a tool to extract git repository data in XML format.
     15 It outputs data to stdout, suitable for piping to other tools or templating.
     16 The repository can be a bare repository or a regular .git directory.
     17 .Pp
     18 The commands are:
     19 .Bl -tag -width Ds
     20 .It Xo
     21 .Cm log
     22 .Ar repo
     23 .Op Ar N
     24 .Xc
     25 Output commit log in XML format.
     26 .Ar N
     27 is the number of commits to output, default is 100.
     28 Each commit contains oid, parent, author, summary, message and stats.
     29 .It Xo
     30 .Cm commit
     31 .Ar repo
     32 .Op Ar oid
     33 .Xc
     34 Output commit detail in XML format.
     35 .Ar oid
     36 defaults to HEAD if not specified.
     37 The output includes the full diff with hunks and lines.
     38 .It Xo
     39 .Cm tree
     40 .Ar repo
     41 .Op Ar oid
     42 .Xc
     43 Output tree (file listing) in XML format.
     44 .Ar oid
     45 defaults to HEAD if not specified.
     46 Each entry contains path, mode, type (blob/tree/commit), oid and size (for blobs).
     47 .It Xo
     48 .Cm blob
     49 .Ar repo
     50 .Ar path
     51 .Op Ar oid
     52 .Xc
     53 Output raw file content to stdout.
     54 .Ar path
     55 is the path to the file relative to the repository root.
     56 .Ar oid
     57 can be specified to get the file at a specific commit.
     58 Use the
     59 .Cm tree
     60 command to get the file oid and size.
     61 .It Xo
     62 .Cm refs
     63 .Ar repo
     64 .Xc
     65 Output references (branches and tags) in XML format.
     66 Each reference contains its name and the commit it points to.
     67 .El
     68 .Sh EXIT STATUS
     69 .Ex -std
     70 .Sh EXAMPLES
     71 .Bd -literal
     72 # Get last 10 commits
     73 git-query log /path/to/repo 10
     74 
     75 # Get specific commit
     76 git-query commit /path/to/repo abc123def
     77 
     78 # Get file tree at HEAD
     79 git-query tree /path/to/repo
     80 
     81 # Get file content
     82 git-query blob /path/to/repo README.md
     83 
     84 # Get list of branches and tags
     85 git-query refs /path/to/repo
     86 .Ed
     87 .Sh AUTHORS
     88 .An Jul Aq Mt jul@9o.is