Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uit

uit renders line-numbered contents from Git-tracked files and can optionally include their directory tree. It is useful when collecting repository context for code reviews, issues, documentation, or AI-assisted development.

Features

  • Optionally renders a deterministic tree of Git-tracked files
  • Renders text files with line numbers
  • Omits binary file contents
  • Limits output per file and marks truncated output
  • Filters files with repeatable include and exclude globs or a regular expression
  • Focuses output on changed, staged, or reference-relative files
  • Automatically uses fzf for interactive multi-selection when safe
  • Copies the complete output to the clipboard

Installation

Download a prebuilt archive from the Releases page.

Alternatively, install from source with Go:

go install github.com/mnishiguchi/uit/cmd/uit@latest

Usage

uit [options] [path]

When path is omitted, uit uses the current directory.

# Render the current repository
uit

# Render one directory
uit internal/cli

# Include the repository tree
uit --tree

# Render only the repository tree
uit --tree-only

# Include Go and Markdown files, excluding tests
uit --include '*.go' --include '*.md' --exclude '*_test.go'

# Apply an advanced regular-expression filter
uit --filter '^internal/.*\.go$'

# Render staged and unstaged changes to tracked files
uit --changed

# Render only staged files
uit --staged

# Render committed and local differences from the main branch
uit --since origin/main

# Render at most 200 lines per file and copy the result
uit --max-lines 200 --copy

# Force interactive file selection
uit --select always

# Render one file without a tree
uit README.md

Use uit --help for the complete option list.

Requirements

  • Git must be available in PATH.
  • Building from source requires Go 1.26.5 or newer.
  • Automatic interactive selection uses fzf when it is available in PATH.
  • --select always and its --fzf alias require fzf.
  • On Linux, --copy requires xclip or xsel.

Behavior

  • A directory path must be inside a Git repository; its output includes only Git-tracked files.
  • File input is rendered directly, even when the file is untracked or outside a Git repository.
  • File contents are rendered without a tree by default. --tree adds the full tree, and --tree-only omits file contents.
  • --include and --exclude accept repeatable, case-sensitive globs. Patterns without / match basenames at any depth, ** crosses directories, and a trailing / matches all descendants.
  • Multiple include patterns are combined with OR, while any matching exclude pattern removes the file. --filter adds a regular-expression constraint.
  • --changed includes staged and unstaged changes to tracked files; --staged includes only staged files; and --since REF includes committed and local differences from REF. These scopes are mutually exclusive.
  • Deleted and untracked files are omitted from Git file scopes because uit renders existing Git-tracked file contents.
  • The default limit is 1,000 lines per file; --max-lines 0 disables it.
  • Interactive selection defaults to auto: it runs only for directory input when fzf is installed, all standard streams are terminals, and CI is not set. Use --select always to require it or --select never to disable it.
  • Git file scopes, path filters, and interactive selection limit file contents; a requested tree remains complete.
  • File input does not include a tree.

Development

Run all local checks:

make check

Build release binaries:

make build

Create release archives:

make package

See RELEASE.md for the release procedure.

License

MIT. See LICENSE.

About

Uithub-Inspired Tool

Resources

Stars

20 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages