A toolkit for people developing Gradle itself. It manages a single bare clone of the Gradle repository and gives every branch its own git worktree, so you can switch between branches, PRs, and built distributions without stashing or rebuilding the world.
This is the successor of genv, extending the environment idea with a worktree-based workflow.
With gt, you can:
- Keep one bare repository and check out each branch into its own worktree
- Fetch GitHub PRs straight into worktrees (
gt pull 12345) - Build a Gradle distribution from any worktree and alias
gradleto it (gt install+gt use) - Reclaim disk space and prune merged-PR branches (
gt cleanup)
The tool builds upon fish and fisher.
fisher install hegyibalint/gradle-toolboxThen initialize it from a remote URL (bare clone) or an existing local clone:
gt init https://github.com/gradle/gradle.gitEverything lives under $XDG_DATA_HOME/gradle-toolbox (repo, worktrees, shared resources).
gt create my-feature -o -n # branch off master, open in IDEA, cd into it
gt pull 30123 -o # fetch PR #30123 into a pull/30123 worktree
gt install my-feature # build a distribution (--all for sources)
gt use my-feature # alias `gradle` to that distribution
gt cleanup cache --dry-run # see what disk space can be reclaimedEvery worktree lives under the data directory at worktrees/<branch>, so the branch name doubles as the worktree path. Whenever a worktree is created, shared resources from the data directory's resources/ folder (e.g., agent docs, .claude config) are copied into it.
One-time setup, pointing the toolbox at the Gradle repository. Given a URL, clones a bare copy for the toolbox to manage; given a path to an existing local clone, uses that in place. All subsequent commands work against this repository.
Runs git fetch --all on the repository.
Runs an arbitrary git command against the repository, from anywhere. Useful since the bare repo has no working directory to cd into. The gtg shorthand saves typing gt git every time (e.g., gtg branch -a, gtg log master).
Creates a new branch off master with its own worktree. --open opens it in IntelliJ IDEA, --navigate cd's into it.
Fetches, then checks out an existing branch into a worktree.
Fetches a GitHub PR head into a local pull/<number> branch and creates a worktree for it. Designed for external contributor PRs, where the branch only exists on a fork; for PRs from internal branches, use gt checkout <branch> instead.
Removes the worktree(s) and deletes the branch(es). Refuses to delete if the worktree has uncommitted changes or the branch is not fully merged; --force deletes anyway, losing that work.
Renames a branch and moves its worktree accordingly (git worktree move + git branch -m).
Reclaims disk space by deleting every git-ignored file (build/, .gradle/, .idea/, ...) from the given worktrees, or all of them. Tracked and untracked-but-not-ignored files are kept, so uncommitted work is never touched; nested git repositories are skipped. Prints a per-worktree size report and re-provisions shared resources afterwards. --dry-run only reports what would be freed.
Cross-checks every worktree branch against GitHub (via gh) and offers to delete branches whose PRs are all closed or merged. Branches with an open PR, no PR, or named release are kept. Asks for confirmation before deleting.
Opens the branch's worktree in IntelliJ IDEA.
Changes into, or prints, the branch's worktree path. gt pwd composes well with other tools (e.g., code (gt pwd my-feature)).
Builds a Gradle distribution from the branch into <worktree>/build/dist (./gradlew install). --all builds the full distribution including sources (installAll).
Aliases gradle in the current shell to the branch's installed distribution, printing which branch it runs from on each invocation. Offers to install first if no distribution exists yet.
Re-provisions the shared resources into every worktree. Idempotent: files are only copied over, never removed.