Skip to content

Branches and worktrees

Run branch commands from anywhere inside the target Git repository.

Terminal window
shirei branch feature/my-change

If the branch exists only as a remote branch such as origin/feature/my-change, Shirei creates a local tracking branch in a linked worktree.

Terminal window
shirei branch feature/my-change --base main

Supplying both name and base avoids the branch and base pickers. If the branch already exists, Shirei ignores --base with a warning.

Without a name, shirei branch opens a picker over local and remote branches. A new named branch without --base opens a second picker for its starting ref.

A successful branch command can:

  • Create a local branch and linked Git worktree.
  • Create directories below worktree_root.
  • Update Shirei’s worktree and recent-directory state.
  • Create or reuse a tmux session or Herdr workspace.
  • Run repository setup commands for a newly created worktree.

New worktrees use:

<worktree_root>/<sanitized-repository>/<sanitized-branch>

Characters outside ASCII letters, digits, -, and _ become - in session and path names.

When run_install_on_create = true, Shirei starts an install tmux window or unfocused Herdr tab and runs the first match:

  1. Makefile with an install: target → make install.
  2. package.json → a lockfile-selected package manager install.
  3. Cargo.tomlcargo build.
LockfileCommand
bun.lockb or bun.lockbun install
pnpm-lock.yamlpnpm install
yarn.lockyarn install
package-lock.json or nonenpm install
Terminal window
# List saved entries
shirei worktrees
# Discover linked worktrees again
shirei worktrees scan

A leading ! in the list means the saved path is missing. Listing reads Shirei state and does not reconcile Git.

scan discovers repositories from configured roots and known entries, reads git worktree list --porcelain, and replaces the saved registry. Back up state first when registry continuity matters; a repository inspection failure can remove its old entries from the rebuilt result.

Continue with unfinished work and pruning.