git-bra
brais a worktree manager that covers up the interesting parts of git with a project-aware config
It will help you:
- create or reuse worktrees by branch name
- resolve the path for your worktree branch with
bra go - run project-specific scripts after initialization
- list worktrees and configured scripts
Current Status
The current implementation supports:
bra initbra open <branch-name>bra go <branch-name>bra listbra config pathbra config initbra config showbra script addbra script listbra script allbra script runbra script remove
Install
Build and install locally with Cargo:
This package is set up to install two binaries:
git-braso Git can dispatchgit bra ...braas the short direct command
That means both of these forms work once the package is installed:
Or run it during development with:
If you package this for AUR later, it can simply ship both installed binaries. You do not need to rely on AUR-specific aliasing or shell configuration for git bra support.
Config
bra reads a global config from the XDG config location:
$XDG_CONFIG_HOME/bra/config.toml- fallback:
~/.config/bra/config.toml
For tests and manual overrides, BRA_CONFIG can point to a specific config file.
Example:
= "/home/user/worktrees"
= true
= "-"
[[]]
= "bootstrap"
= "~/bin/bootstrap-my-project.sh"
[[]]
= "test-data"
= "~/bin/seed-my-project.sh"
Config fields:
worktree_destination: base directory where worktrees are createdproject_prefix: when true, nests worktrees under<destination>/<project-alias>/branch_separator: optional replacement for/in branch namesscripts: per-project named scripts, keyed by project alias
Project Resolution
--project is a global option and may be passed to any command.
It accepts either:
- a project alias like
my-project - a path to an existing cloned repository
If --project is omitted, bra tries to infer the project from the current Git repository.
The default alias is taken from the last part of the origin URL:
git@github.com:some-org/my-project.git->my-project
Usage
Create or reuse a worktree for a branch:
Initialize the current repository or worktree:
Print the path for a branch:
List worktrees for the current repository:
Manage scripts:
Run a script directly using the external command shortcut:
Unknown subcommands are treated as script names and forwarded to script run with any additional arguments.
Inspect config:
bra config init creates the config file with commented defaults. The config file is still created automatically the first time a command saves configuration, such as bra script add.
Run a command for another project explicitly:
Shell Integration
bra go prints only the resolved path, so shell wrappers stay simple.
Example for bash or zsh:
If you also want a helper that creates or reuses the worktree and then enters it:
Example usage:
Command Notes
bra initrefuses to reset if the target repository has uncommitted changesbra initfetchesoriginand hard-resets toorigin/<branch>when that remote branch existsbra open <branch>creates the worktree if needed, runs the init flow there, and prints the final pathbra go <branch>prints the parent repository path when that branch is currently checked out in the primary worktree; otherwise it prints the configured worktree pathbra script run <name>runs the configured script in the repository or worktree directory
Development
Run tests with:
The repository also includes integration tests that create temporary Git repositories and exercise real worktree flows.