Read repository files and directories with gh repo read-file and gh repo read-dir
Two new preview commands read repository contents without cloning:
:::shell
# 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-fileandgh repo read-dirare in preview and subject to change without notice.
What's Changed
✨ Features
- feat: add
repo read-fileandrepo read-dirby @babakks in https://github.com/cli/cli/pull/13580 - feat(skills): list available skills when install runs non-interactively by @SamMorrowDrums in https://github.com/cli/cli/pull/13548
- Support custom CLAUDE_CONFIG_DIR in install by @tommaso-moro in https://github.com/cli/cli/pull/13523
🐛 Fixes
- fix(skills): stage updates in a temp dir and swap in-place by @SamMorrowDrums in https://github.com/cli/cli/pull/13449
📚 Docs & Chores
- Make filtering by bot authors more discoverable by @BagToad in https://github.com/cli/cli/pull/13642
- docs(discussion): polish help docs by @babakks in https://github.com/cli/cli/pull/13632
- Bump Go in devcontainer by @spenserblack in https://github.com/cli/cli/pull/13674
:dependabot: Dependencies
- chore(deps): bump golang.org/x/text from 0.37.0 to 0.38.0 by @dependabot[bot] in https://github.com/cli/cli/pull/13640
- chore(deps): bump charm.land/lipgloss/v2 from 2.0.3 to 2.0.4 by @dependabot[bot] in https://github.com/cli/cli/pull/13663
- chore(deps): bump golang.org/x/term from 0.43.0 to 0.44.0 by @dependabot[bot] in https://github.com/cli/cli/pull/13661
- chore(deps): bump github/codeql-action from 4.36.1 to 4.36.2 by @dependabot[bot] in https://github.com/cli/cli/pull/13619
- chore(deps): bump github.com/sigstore/sigstore-go from 1.1.4 to 1.2.1 by @dependabot[bot] in https://github.com/cli/cli/pull/13662
- chore(deps): bump golang.org/x/crypto from 0.52.0 to 0.53.0 by @dependabot[bot] in https://github.com/cli/cli/pull/13641
Full Changelog: https://github.com/cli/cli/compare/v2.94.0...v2.95.0