⏱ around 1 minutes read time
Tagged with:Worktree: manage Git worktrees from the terminal
I have built Worktree, a command-line tool for finding, creating, and switching between Git worktrees across projects.
Git worktrees let you work on different branches in separate directories. You can leave a feature in progress, work on a bug fix, and come back without having to stash your changes each time. With several projects and branches, there are more directories to keep track of.
Worktree brings them together in a searchable picker in the terminal. Register a project once, and its worktrees are available in the picker from any directory. It also discovers worktrees created by Codex automatically.
With the shell integration set up, you can create a worktree and move straight into it:
worktree create fix-parser
Run worktree on its own to open the picker, or use worktree open fix-parser
to switch to that worktree directly.
You can also try another approach without starting over. The fork command
creates a new branch and worktree, carrying over staged and unstaged changes as
well as untracked files:
worktree fork fix-parser experiment
Worktree is free and open source under the MIT license. It runs on macOS and Linux, with shell integration for zsh and bash.
Visit the Worktree website for an overview, or see the installation instructions and source code on GitHub.