githem

convert any git repository to llm-ready text

cli installation

unix/linux/macos
curl -fsSL get.githem.com | sh
windows
iwr -useb get.githem.com/install.ps1 | iex
cargo
cargo install githem

cli usage

# remote repository
githem owner/repo
githem https://github.com/owner/repo

# local directory
githem .
githem /path/to/repo

cli options

-o FILEoutput to file
-i PATTERNinclude patterns (use / suffix for directories)
-e PATTERNexclude patterns
-b BRANCHspecify branch
--preset NAMEfilter preset (see below)
--statsshow token statistics
--treeshow file tree only

cli examples

# source code only
githem owner/repo --preset code-only

# specific files by pattern
githem . -i "*.rs" -e "tests/*"

# include multiple directories
githem . -i "src/, api/, core/"

# output to file
githem owner/repo -o context.txt

# specific branch
githem owner/repo -b develop

# view commit diff
githem owner/repo/commit/abc123f

# compare branches
githem owner/repo/compare/main...feature

api endpoints

replace github.com with githem.com in any github url

/{owner}/{repo}full repository
/{owner}/{repo}/tree/{branch}specific branch
/{owner}/{repo}/tree/{branch}/{path}subdirectory
/{owner}/{repo}/blob/{branch}/{file}specific file path
/{owner}/{repo}/commit/{sha}commit diff
/{owner}/{repo}/compare/{base}...{head}branch comparison
/{owner}/{repo}/pull/{number}pull request diff
/{owner}/{repo}/releases/tag/{tag}tag release

query parameters

?preset=raw, standard, code-only, minimal
?include=comma-separated include patterns
?exclude=comma-separated exclude patterns
?branch=branch name (alternative to /tree/)
?ctx=diff context lines (like -U), defaults to 3

api examples

# full repository
curl https://githem.com/owner/repo

# with preset
curl "https://githem.com/owner/repo?preset=code-only"

# filter by directory
curl "https://githem.com/owner/repo?include=src/,lib/"

# specific branch
curl https://githem.com/owner/repo/tree/develop

# subdirectory only
curl https://githem.com/owner/repo/tree/main/src

# commit diff (supports short sha)
curl https://githem.com/owner/repo/commit/abc123f

# commit diff with no context (like -U0)
curl "https://githem.com/owner/repo/commit/abc123f?ctx=0"

# compare branches
curl https://githem.com/owner/repo/compare/main...feature

# pull request
curl https://githem.com/owner/repo/pull/123

# api info endpoint
curl https://githem.com/api

gitlab support

githem also supports gitlab urls with /-/ path format

curl https://githem.com/gitlab-org/gitlab/-/commit/abc123
curl https://githem.com/gitlab-org/gitlab/-/merge_requests/123

presets

raw

no filtering - all files included as-is

standard

smart filtering - excludes node_modules, build artifacts, media, binaries

code-only

source code files only - great for code review

minimal

basic filtering with smaller output

cache management

githem --cache-stats
githem --clear-cache
githem owner/repo --no-cache

faq

what files are filtered by default?

node_modules, vendor, target, .git, build artifacts, media files (images, videos), binary files, lock files (package-lock.json, yarn.lock, etc.)

how do i access private repositories?

use ssh: githem [email protected]:company/private.git

what size reduction can i expect?

typically 60-80% reduction with the standard preset. code-only preset usually achieves 80-95% reduction.

how are tokens estimated?

approximately 1 token per 4 characters. use --stats for exact counts.

can i use short commit shas?

yes! any sha with 7+ characters works: /owner/repo/commit/abc123f

is there rate limiting?

the api has generous limits. for heavy usage, consider running your own instance.