gw is a simple wrapper around git worktree command. it adds a custom configuration per repository to specify the worktree path and commands to run on worktree creation.
download the binary from the releases page or install from source using the following command:
go install github.com/flexphere/gw@latest
gw init \
--worktree-path ~/.worktree \ # setup current repository to create its worktrees under "~/.worktree"
--cmd "echo hello" --cmd "echo world" # run `echo hello` and `echo world` on worktree creation
gw new name-of-worktree
gw edit # opens the config file in the editor
every other command then above is redirected to git worktree
command
gw list # executes `git worktree list`
gw prune # executes `git worktree prune`
...