Skip to content

Git Integration

Navi displays git information for each session’s working directory: current branch, dirty status, ahead/behind counts, last commit, and GitHub PR detection.

Each session row shows git info when available:

⚙️ my-session 3m ago
~/projects/app feature/login ● +3 [PR #42]
  • Branch name: Current branch (truncated to 30 characters)
  • Dirty indicator: when there are uncommitted changes
  • Ahead/behind: +3 commits ahead, -1 commits behind remote
  • PR number: PR#42 when a GitHub PR is detected for the branch

Press G to open the git detail view for the selected session. This shows:

  • Full branch name
  • Remote URL
  • Last commit (hash + subject)
  • Ahead/behind counts
  • GitHub PR link
  • Recent diffs (up to 5000 lines)

Navi auto-detects GitHub PRs by:

  1. Parsing the git remote URL (HTTPS or SSH format)
  2. Extracting the owner and repository name
  3. Using gh pr view --json number to look up PRs for the current branch
  4. Caching the result to avoid repeated API calls

The gh CLI must be installed and authenticated for PR detection to work.

Git information is polled separately from session status:

  • Local sessions: Runs git commands in the session’s working directory
  • Remote sessions: Executes a bundled git info script over SSH (cd <cwd> && git branch --show-current && git status --porcelain && ...)
  • Cache: Git info is cached with a 5-second TTL and 10-second max age
  • PR cache: PR numbers are cached per branch to minimize gh API calls