convert any git repository to llm-ready text
curl -fsSL get.githem.com | sh
iwr -useb get.githem.com/install.ps1 | iex
cargo install githem
# remote repository
githem owner/repo
githem https://github.com/owner/repo
# local directory
githem .
githem /path/to/repo
-o FILE | output to file |
-i PATTERN | include patterns (use / suffix for directories) |
-e PATTERN | exclude patterns |
-b BRANCH | specify branch |
--preset NAME | filter preset (see below) |
--stats | show token statistics |
--tree | show file tree only |
# 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
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 |
?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 |
# 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
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
no filtering - all files included as-is
smart filtering - excludes node_modules, build artifacts, media, binaries
source code files only - great for code review
basic filtering with smaller output
githem --cache-stats
githem --clear-cache
githem owner/repo --no-cache
node_modules, vendor, target, .git, build artifacts, media files (images, videos), binary files, lock files (package-lock.json, yarn.lock, etc.)
use ssh: githem [email protected]:company/private.git
typically 60-80% reduction with the standard preset. code-only preset usually achieves 80-95% reduction.
approximately 1 token per 4 characters. use --stats for exact counts.
yes! any sha with 7+ characters works: /owner/repo/commit/abc123f
the api has generous limits. for heavy usage, consider running your own instance.