Grove is a wrapper around the git worktree command.
Grove takes the approach of "every branch should have it's own worktree".
go install github.com/jacobdrury/grove@latest# Initialize grove in your repository
grove init
# Checkout a worktree
grove checkout <branch-name>All other commands are automatically forwarded to git worktree.
grove prune # gets run as 'git worktree prune'The Grove configuration file is located in .grove/config.yaml within your repository root.
# The directory in which worktrees will be stored.
worktrees-directory: ./worktrees
# Used to resolve branch names
branch-resolver:
branch-delimiter: /
prefix-aliases: {}
# Commands to run during different events.
hooks:
shell: C:\WINDOWS\system32\cmd.exe
after-checkout: []Grove supports a variety of hooks that will run the listed commands when the corresponding event is triggered. All commands will be run with the configured shell.
hooks:
shell: C:\WINDOWS\system32\cmd.exe
after-checkout:
- quick-buildThe above config will run the quick-build command within the new worktree directory after it's been checked out.
In the .grove directory you will find a seed directory. This directory contains files that you wish to seed new worktrees with when they are created. The directory structure found within the seed directory will be maintained when the worktree is seeded.
Branch names can be resolved using custom 'prefix aliases' configured in .grove/config.yaml.
branch-resolver:
branch-delimiter: /
prefix-aliases:
f: feature
c: choreWith the above configuration, the following would be true:
grove checkout f/some-feature # would checkout `feature/some-feature`This will also perform slug resolution.
git checkout -b feature/1234-example # create a new branch
grove checkout f/1234 # resolves to `feature/1234-example`