Skip to content

v0.8.0

Choose a tag to compare

@github-actions github-actions released this 20 Feb 23:32
· 51 commits to main since this release
b3814d8

What's New

➖ Previous Worktree Shorthand

Jump back to your last worktree instantly with the - shorthand — just like cd - in the shell.

gren switch -        # Go back to previous worktree
gren navigate -      # Same with navigate alias

The TUI also displays a visual indicator next to the previously active worktree.

🔀 PR/MR Branch Checkout

Check out any pull request or merge request branch directly using a short prefix — no more looking up branch names.

gren switch pr:123   # GitHub: check out branch for PR #123
gren switch mr:456   # GitLab: check out branch for MR !456

Requires gh (GitHub) or glab (GitLab) CLI to be installed and authenticated.

🪝 Post-Remove Hook

Run custom commands automatically before a worktree is deleted — clean up databases, stop services, or notify teammates.

.gren/config.toml

[[hooks]]
type = "post-remove"
command = "echo 'Cleaning up {{ branch }}'"

The hook receives full context via GREN_CONTEXT (branch, path, repo root, etc.).

📋 JSON Output for gren list

Get machine-readable worktree data for scripting, dashboards, and shell pipelines.

gren list --format=json
gren list --format=json | jq '.[].branch'
gren list --format=json | jq '.[] | select(.is_current)'

Output includes: name, branch, path, status, counts (staged/modified/untracked/unpushed), stale reason, and more.

🔁 gren for-each with --fail-fast

Run a shell command in every worktree sequentially. The new --fail-fast flag stops on the first failure.

gren for-each -- git pull
gren for-each -- npm run lint
gren for-each --fail-fast -- npm test
gren for-each --skip-main -- echo "Branch: {{ branch }}"

📊 gren diff

See everything you've changed on the current branch in one unified view — committed, staged, unstaged, and untracked files.

gren diff               # Diff vs auto-detected default branch
gren diff --base main   # Diff vs specific branch
gren diff | delta       # Pipe to your favourite diff viewer

Uses git merge-base to find the exact divergence point so you only see your changes.

Improvements

  • CI test stability: All go test invocations now use -p 1 to prevent os.Chdir race conditions
  • Error output: CLI errors now consistently go to stderr, keeping stdout clean for piping
  • JSON schema consistency: All numeric and string fields in gren list --format=json are always present (no surprise nulls)

Installation

Homebrew (macOS/Linux)

brew upgrade gren
# or fresh install:
brew tap langtind/tap && brew install gren

Go

go install github.com/langtind/gren@v0.8.0

Full Changelog: v0.7.1...v0.8.0