Skip to content

jacobdrury/grove

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grove

Grove is a wrapper around the git worktree command.

Grove takes the approach of "every branch should have it's own worktree".

Features

Installation

go install github.com/jacobdrury/grove@latest

Usage

# 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'

Configuration

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: []

Hooks

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-build

The above config will run the quick-build command within the new worktree directory after it's been checked out.

Worktree Seeding

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 Name Resolution

Branch names can be resolved using custom 'prefix aliases' configured in .grove/config.yaml.

branch-resolver:
    branch-delimiter: /
    prefix-aliases:
        f: feature
        c: chore

With 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`

About

🌳 Grove is a wrapper around the git worktree command

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages