releases.shpreview

Read repo files and directories without cloning

v2.95.0

3 features1 fixThis release3 featuresNew capabilities1 fixBug fixesAI-tallied from the release notes

Read repository files and directories with gh repo read-file and gh repo read-dir

Two new preview commands read repository contents without cloning:

# Read a single file to stdout
gh repo read-file README.md --repo cli/cli

# Read from a specific branch, tag, or commit
gh repo read-file go.mod --ref v2.94.0 --repo cli/cli

# Write a file to disk (use --clobber to overwrite)
gh repo read-file README.md --output ./README.md --repo cli/cli

# List the entries in a directory
gh repo read-dir script --repo cli/cli

Both commands default to the repository's default branch, accept --ref to target any branch, tag, or commit, and support --json, --jq, and --template for scripting. This makes it easy for agents and automation to inspect a repo without a full checkout.

Note

gh repo read-file and gh repo read-dir are in preview and subject to change without notice.

What's Changed

✨ Features

🐛 Fixes

📚 Docs & Chores

:dependabot: Dependencies

Full Changelog: https://github.com/cli/cli/compare/v2.94.0...v2.95.0

Fetched June 17, 2026