npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

git-workspace-bare

v1.0.1

Published

Manage Git worktrees as development workspaces

Readme

git-workspace-bare

Manage Git worktrees as development workspaces.

Clone or initialize GitHub repositories under ~/workspace, create and rename branch worktrees, inspect their status, and remove checkouts you no longer need. Keep the workspace layout in a Git-tracked manifest and synchronize it across machines. Command hooks provide optional integrations such as tmux session management.

Contents

Installation

The CLI runs on Bare. Install both globally using npm:

npm install -g bare git-workspace-bare

This makes the git-workspace command available in your shell. Git also discovers it on your PATH, so you can run it as git workspace. Bare must be on your PATH; Node.js and npm are used for package installation and development tooling.

For optional integrations such as tmux session management, see available hooks.

Manual page

The package includes a git-workspace(1) manual covering commands, options, manifest synchronization, and hooks:

git workspace --help
git help workspace
man git-workspace

Global installation (or npm link during development) registers the page with npm versions that support man-page linking. If your system cannot find it, add this line to your shell startup file to include the packaged manual in its search path:

export MANPATH="$(npm root -g)/git-workspace-bare/man:${MANPATH:-}"

The trailing empty entry preserves your system's default manual paths. This also works with npm 12, which no longer registers man pages automatically.

If a shell wrapper intercepts git workspace --help and shows CLI usage instead, use git help workspace or man git-workspace to open the manual directly.

Bash completion

Add this line to ~/.bashrc (or the startup file your interactive Bash shell loads):

eval "$(git-workspace completion bash)"

For git workspace completion, also enable Git's Bash completion. The workspace script extends it; existing Git completions are preserved. The direct git-workspace command has completion even without Git's completion script. Open a new shell or run that line in your current shell to enable it. Bash 3.2 and newer are supported.

Tab completes commands, flags, and registered repository/worktree names for remove and the source of rename. For add, it suggests registered roots; after owner/repo@, it suggests local branches and already-fetched origin branches. New repository and branch names can still be typed freely. Completed repository names have no trailing space, so you can press Enter or append @ and complete a branch. For a branch rename's destination, it fills the owner/repo@ prefix so you can type the new branch name.

Suggestions use local data only, without fetching or changing the workspace. Missing or invalid workspace data silently produces no repository suggestions; commands and flags remain available before init. Currently only Bash is supported.

Usage

git workspace -h
git workspace --version
git workspace init nicolasfont/workspace
git workspace add holepunchto/brittle
git workspace add holepunchto/brittle@jobs
git workspace list
git workspace pull --dry-run
git workspace prune --dry-run
git workspace rename holepunchto/brittle@jobs holepunchto/brittle@fixes
git workspace remove holepunchto/brittle@fixes
git workspace remove holepunchto/brittle
  • -h shows the available options; git workspace --help opens the manual page.
  • --version prints the package version.
  • remove -f allows deleting local changes and untracked files; prune -f skips confirmation but still skips dirty worktrees.

You can also invoke the executable directly, for example git-workspace list. Use git workspace -h or git-workspace --help for CLI help; Git handles git workspace --help as a manual-page request.

Running git workspace without arguments exits successfully without printing anything.

Initialize a manifest repository

Initialize your manifest repository:

git workspace init nicolasfont/workspace

This tries to clone the repository over SSH into ~/workspace/nicolasfont/workspace. If cloning fails and the destination is absent or empty, it initializes a local Git repository there and sets origin to the GitHub SSH URL. The clone failure is reported because a missing repository, authentication failure, and network failure can look similar. Existing nonempty destinations are never overwritten.

Creating the repository on GitHub remains manual. Manifest commits are pushed automatically when the remote is available. Initialization saves ~/.config/git-workspace/config.json with a manifestRepository field containing the absolute checkout path. The local repository uses workspace.json as the manifest, storing portable repository names rather than machine-specific absolute paths:

{
  "version": 1,
  "repositories": [
    {
      "id": "8257b322-695c-4c97-a816-c6c2c6198e40",
      "name": "holepunchto/brittle",
      "worktrees": [
        {
          "id": "37326a40-98e7-461b-9dd3-fc6a57f0b856",
          "branch": "feature/jobs"
        }
      ]
    }
  ]
}

On every machine, those names resolve under ~/workspace. list still displays owner/repo and owner/repo@branch; IDs are stored in the manifest, not used in CLI arguments.

Each repository and linked worktree gets a UUID when first registered. Renaming a repository (including changing its owner) preserves its ID and all its worktree IDs. Renaming a branch worktree preserves its ID. Removing an entry deletes it from the current manifest; reusing that name later creates a new ID. Old identities remain in Git history, so names are not reserved forever. Treat IDs as permanent identifiers when editing the manifest manually.

IDs must be unique across the entire manifest, and repository names and worktree names must not be duplicated. Worktrees belong to their root repository. Invalid entries and unsupported manifest versions are rejected before changing checkouts. The manifest records desired state; reading it does not apply changes. A local applied-commit checkpoint records verified state; git workspace pull synchronizes the local layout, and --dry-run previews changes first.

If the manifest repository has no workspace.json, initialization writes an empty version-1 manifest and saves it using the manifest commit and push behavior.

If the commit fails, init reports the Git error and leaves the new manifest on disk. Resolve the error, commit only workspace.json in the manifest repository, then rerun init.

If a version-1 workspace.json already exists, it is validated and preserved without creating a commit, even if it has uncommitted edits. Initialization does not clone or remove the repositories listed in the manifest. Repeating init with the same manifest repository preserves local edits and does not pull. A different manifest origin is refused.

Run init before using add, remove, rename, list, status, pull, or prune. These commands locate workspace.json through the saved config file.

Only the version-1 object format is supported. Keep IDs when editing entries; replacing an ID means replacing that entry's identity.

Manifest commits and pushes

init commits a newly created manifest. Successful add, remove, and rename commands commit the current workspace.json, including pending manual edits. Only that file is committed; unrelated staged files remain staged. Git identity, commit hooks, and signing settings apply as usual. If the manifest matches the last commit, no new commit is created. Each command then attempts to push the manifest branch; repeating init with an existing manifest does not commit or push it.

Commit messages follow the operation:

| Command | Commit message | | -------- | ------------------------------- | | init | Initialize workspace manifest | | add | Add <repository> | | remove | Remove <repository> | | rename | Rename <from> to <to> |

Adding a branch and its root together makes one commit. A root rename and its linked worktrees also make one commit. Prune uses remove for each confirmed worktree, so each removal follows the same commit and push behavior. Pull applies the fetched manifest without creating commits or pushing.

Automatic pushes target the manifest branch's configured upstream, or the same branch name on origin when no upstream is configured. A successful push establishes tracking. Only that manifest branch is pushed, including its existing local commits; project branches and tags are not published. Pushes never force, fetch, or merge remote history.

A push failure warns without undoing the checkout operation or local commit, changing the command's success status, or preventing local applied tracking and post hooks. This allows commands to work offline or before the manifest repository exists on GitHub. Once connected, repeat add for an already registered checkout to retry the push without another commit, or push from the manifest repository yourself (for a new upstream, git push -u origin HEAD). For a non-fast-forward rejection, resolve the divergent manifest history before retrying.

After successful init, add, remove, and rename commands, the CLI automatically verifies the committed manifest against this machine's checkouts and records the applied commit locally. This checkpoint lets pull identify changes to apply on this machine; it does not create commits or push anything. Dirty files and local commits in your repositories are allowed. If verification finds a mismatch, the completed operation is preserved and a warning explains why local tracking could not advance. Tracking is checked again on the next successful command that initializes or changes the workspace. list and status do not change it.

Synchronize from the manifest

git workspace pull --dry-run
git workspace pull

Fetches the manifest branch from its configured upstream. If the local branch has no upstream, it uses the same branch name on origin. The manifest repository must be on a branch with a clean working tree and index. Divergent histories are refused; local commits ahead of the remote are retained; pull itself does not push them.

The preview compares the latest manifest with this machine's last verified applied state. Matching IDs identify renames, even across owners. A root rename includes its worktrees; branch renames are listed separately only when the branch name changes. Removed children are listed before their parents, and parents are added before children. Reusing a name with a new ID means removing the old entry and adding the replacement.

For example:

Manifest: origin/main
Would fast-forward the manifest
rename owner/repo -> other/new
rename other/new@jobs -> other/new@fixes
add other/new@feature/new
Dry run: no manifest checkout or workspace changes applied

The planner reports missing or mismatched checkouts, occupied destinations, existing branch targets, locked worktrees, and dirty checkouts that would be removed. Dirty work is allowed in retained or renamed checkouts. Blockers are printed with blocked: and exit status 1; the preview still shows the requested changes. These checks describe local conditions now; they cannot guarantee a future clone or filesystem operation will succeed.

On a new machine without an applied baseline, the preview plans additions and reports matching existing checkouts as adopt. It does not infer old removals or renames from history before that machine's first verified baseline. Unexpected local layout changes after a baseline are reported for manual resolution.

Without --dry-run, pull checks for blockers before fast-forwarding the manifest and applying the layout changes. It moves renamed checkouts, updates renamed roots' origin URLs, removes clean retired checkouts, and clones or creates additions. GitHub renames and transfers remain manual. Clean removals can delete local commits, just like git workspace remove; preview the plan before applying removals. Existing managed repositories are never fetched or pulled. Pull creates no manifest commits and pushes nothing. Unlike a direct add, pull requires new repositories to clone successfully; it never substitutes an empty local repository for an unavailable remote.

If an operation fails, completed changes remain in place. Resolve the reported error and rerun git workspace pull to resume the saved target. The next pull fetches any newer remote changes. Progress is stored locally in .git/workspace-pull.json, with the target commit pinned at refs/git-workspace/pull-target. Other commands that modify the manifest are blocked while a pull is pending. Local applied tracking advances only after the complete layout has been verified; progress is then cleared. Do not edit or delete the progress file to retry. A dry run during recovery checks the remaining changes without applying them; a partially moved rename may need a real pull to repair its Git links before those checks can finish.

A dry run fetches objects and updates Git's fetch metadata and remote-tracking refs in the manifest repository. It never checks out the fetched manifest, applies layout changes, advances local applied tracking, creates commits, or pushes.

Add a root repository

With Git on your PATH:

git workspace add holepunchto/brittle

The required owner/repo identifies a GitHub repository, including one you have not created on GitHub yet. If ~/workspace/holepunchto/brittle is absent or an empty directory, the command tries to clone [email protected]:holepunchto/brittle.git there. The default workspace directory is ~/workspace, regardless of your current directory.

If cloning fails and the destination is still absent or empty, add initializes an empty local Git repository and configures that URL as origin. This works offline and when the remote does not exist or is inaccessible, with no flag or confirmation required. The clone diagnostic is preserved, followed by a notice explaining that a local repository was initialized. The checkout is registered and committed to the manifest normally, and add hooks run normally. No GitHub repository is created and no project commits are pushed.

The local repository follows Git's init.defaultBranch setting and has no initial commit. Create your first commit when ready. Later remote synchronization is explicit: repeating add reuses the local checkout, even once you are online. If the remote already has history, reconcile that history with any commits you made locally before pushing.

Default SSH clone attempts use a five-second connection timeout, one connection attempt, and noninteractive authentication, using keys already available to SSH. The timeout covers the SSH connection and initial handshake, not the entire clone or system DNS resolution. Custom GIT_SSH, GIT_SSH_COMMAND, core.sshCommand, and non-OpenSSH variants keep their own transport settings; URL rewrites to other transports also retain their own connection behavior.

A failed clone that leaves files behind is preserved and reported as an error. Initialization never overwrites a nonempty destination or follows a destination symlink. Git invocation, interruption, and local filesystem failures remain errors.

If the destination already contains files, it must be a Git worktree root whose origin points to the requested GitHub repository. SSH and HTTPS origins are accepted. Repeating the command does not pull, switch branches, or add duplicate entries. Existing repositories elsewhere are not moved.

Registered names are saved using the manifest commit and push behavior. Cloning shows Git's progress; registering an existing checkout is silent. A destination validation failure leaves the manifest unchanged. If registration fails after cloning or local initialization, the checkout remains on disk; fix the manifest issue and rerun the same command. If committing fails, the checkouts and manifest are retained; resolve the reported Git error and rerun the same add command to retry the commit.

add accepts repository names, not filesystem paths. Session management can be provided by a command hook.

Add a branch worktree

git workspace add holepunchto/brittle@jobs

First ensures ~/workspace/holepunchto/brittle exists and is registered, cloning it or initializing it locally if necessary. Then creates and registers ~/workspace/holepunchto/brittle@jobs:

  • Uses the local jobs branch if it exists, preserving its commits and upstream without fetching.
  • Otherwise fetches origin, then creates jobs tracking origin/jobs if it exists.
  • Otherwise creates jobs from the root checkout's current HEAD, without an upstream.

The fetch follows origin's configured fetch refspecs and disables automatic tag following. If it fails, the command warns and uses cached remote refs instead. With no cached match, it creates a local branch without an upstream; this keeps offline work possible, but means an unreachable remote branch cannot be discovered. An interrupted fetch aborts the add.

An empty root needs its first commit before a branch worktree can be created. If the root was just initialized locally, it stays registered and the command explains how to make the first commit and retry. It does not fabricate a commit to create the worktree.

The root checkout's branch and local edits remain unchanged. If the destination already exists, it must belong to the same Git repository and be on the requested branch; it is reused without fetching, switching branches, or changing its upstream. Git refuses creation when the branch is checked out elsewhere.

Branch names containing / use nested directories. For example, git workspace add holepunchto/brittle@feature/jobs creates branch feature/jobs at ~/workspace/holepunchto/brittle@feature/jobs. Use the same name for remove; list preserves the slashes. Invalid branch names are rejected before cloning or registration.

If worktree creation fails, the root repository remains registered and its manifest change remains uncommitted. If registration fails after creation, the worktree remains on disk; fix the registry issue and retry the same command.

The entry is saved using the manifest commit and push behavior.

Rename a root repository

git workspace rename holepunchto/git-workspace holepunchto/git-workspace-bare

Moves the root checkout and its linked owner/repo@branch directories to the new repository name, repairs Git's worktree links, and updates their manifest entries. Branch names, commits, and uncommitted files are preserved. Linked worktrees outside this naming layout stay in place and their Git links are repaired too.

The local origin URL is updated to the new name, preserving SSH or HTTPS format. Explicit origin push URLs pointing to the old repository are updated too; URLs pointing elsewhere and other remotes are left alone. An origin already pointing to the new name is also accepted.

The checkout rename does not rename anything on GitHub, fetch, or push project commits. Rename the repository separately in GitHub Settings → General → Repository name, or run:

gh repo rename git-workspace-bare --repo github.com/holepunchto/git-workspace

That separate command changes the GitHub repository's name without pushing commits. It requires an authenticated GitHub CLI and repository admin permissions. You can do the GitHub rename before or after the local rename; the new origin URL will only work once the GitHub repository has the new name.

Both arguments must use owner/repo. The owner can change too: the root and linked worktrees move under the new owner's workspace directory, and origin URLs follow the new owner/repo. Transfer ownership on GitHub separately; the local command does not perform that transfer. The source must be a registered standalone root checkout with the expected GitHub origin. Existing destination paths or manifest entries, missing or invalid linked worktrees, linked worktrees containing submodules, locked worktrees that would move, and symbolic-link checkouts are refused. The active manifest repository itself cannot be renamed. If a local move, Git repair, or manifest write fails, the command attempts to restore the original paths and origin configuration and reports any failure to restore them.

Renaming preserves the root and worktrees' stable manifest IDs.

The new names are saved using the manifest commit and push behavior.

If committing fails, the renamed checkouts, origin configuration, and updated manifest are retained. Resolve the Git error and commit only workspace.json in the manifest repository, for example:

git commit --only -m "Rename holepunchto/git-workspace to holepunchto/git-workspace-bare" -- workspace.json

The rename is already complete, so do not rerun it using the old name to retry the commit.

Rename a branch worktree

git workspace rename holepunchto/brittle@jobs holepunchto/brittle@fixes

Renames a branch worktree and the branch it holds together, so the directory name and the checked-out branch stay in sync. It moves ~/workspace/holepunchto/brittle@jobs to ~/workspace/holepunchto/brittle@fixes, renames the local branch with git branch -m, and updates the manifest entry. Uncommitted work moves with the directory; the worktree does not need to be clean.

Both arguments are full owner/repo@branch names, and the owner/repo part must match: a worktree cannot be renamed into a different repository.

The branch actually checked out does not have to match the @branch in the source name. If you switched branches inside a worktree with ordinary Git, rename it to the branch it now holds to line the directory back up:

git workspace rename holepunchto/brittle@jobs holepunchto/brittle@wandered

That moves the directory only. Renaming never touches a branch other than the one the worktree has checked out, so a branch left behind by git switch -c survives.

If the branch has an upstream, it is retargeted to the matching branch on the same remote, so renaming jobs to fixes leaves it tracking origin/fixes rather than origin/jobs. That remote branch may not exist yet; push it before pulling. Branches without an upstream stay without one, and remote branches are never renamed or deleted.

Renaming is refused if the destination directory exists, if the new branch name is already taken by another branch, if the source is not registered or not checked out, or if the worktree is on a detached HEAD. Nested branch names use nested directories, as with add, and empty parent directories left behind are removed.

The worktree keeps its stable manifest ID and follows the shared manifest commit and push behavior. If committing fails, the rename is already complete: commit only workspace.json manually instead of rerunning the rename with its old name.

List repositories

git workspace list

Prints registered repositories as owner/repo and linked worktrees as owner/repo@branch, one per line sorted alphabetically, regardless of the current directory:

holepunchto/brittle
holepunchto/brittle@jobs

An empty manifest produces no output. Missing or invalid manifest data reports an error.

Repositories remain listed even if their directories no longer exist. Listing does not modify the registry.

Check workspace status

git workspace status

Checks up to four checkouts concurrently and prints each result as soon as it finishes, followed by clean, modified, or missing. Rows stay aligned, but their order depends on completion time. Modified includes staged changes, unstaged changes, and untracked files; ignored files do not count. Missing means the checkout path no longer exists. If a check fails, completed results remain visible and the command exits with an error.

An empty registry produces no output. Existing paths that are not valid Git worktree roots report an error. Status does not fetch, modify the registry, or refresh Git's index on disk. It does not report whether branches are ahead of or behind their remotes.

Remove a root repository

git workspace remove holepunchto/brittle

Deletes the root checkout, including its local Git history and branches, and removes its registry entry. The destination must be a standalone root repository with the expected GitHub origin. The active manifest repository cannot be removed. Removal refuses local changes, untracked files, symbolic-link destinations, or any linked worktrees (including stale worktree records). Remove linked worktrees first. Ignored files are deleted with the checkout, and remote repositories are untouched. Local commits are not checked for whether they have been pushed.

Use -f or --force to delete a root checkout with local changes or untracked files. The other protections still apply.

Supply the same owner/repo or owner/repo@branch used by add. Paths resolve under ~/workspace, regardless of the current directory. If a registered directory is already missing, branch deletion is still attempted; an already missing branch is accepted. No GitHub connection is needed. Session cleanup can be provided by a command hook.

The removal is saved using the manifest commit and push behavior.

If committing fails, the checkout and registration are already removed. Resolve the reported Git error and commit only workspace.json in the manifest repository, for example:

git commit --only -m "Remove holepunchto/brittle" -- workspace.json

Rerunning remove is not the commit recovery step: a missing, unregistered checkout still reports an error.

Successful removal is silent. Existing checkouts can also be removed if previously unregistered. A missing, unregistered repository reports an error. Path-based remove is not supported.

Remove a branch worktree

git workspace remove holepunchto/brittle@jobs

Verifies the linked worktree belongs to the root repository, removes the worktree directory, deletes the branch it actually had checked out with git branch -D, and unregisters it. The checked-out branch does not have to match the @branch in the name: a worktree you switched to another branch is still removed, and that branch is the one deleted. A worktree left on a detached HEAD is removed without deleting any branch. Branch deletion skips Git's merged-status check, including for squash-merged PRs or unmerged local commits. Worktree removal still refuses dirty or locked worktrees, and remote branches are untouched. Unregistered worktrees can also be removed this way.

After successful worktree and branch removal, empty branch-parent directories are removed up to, but not including, the owner directory. Parents containing sibling worktrees or other files remain.

Use -f or --force to delete a worktree with local changes or untracked files. Locked worktrees are still refused. For example:

git workspace remove -f holepunchto/brittle@jobs

If branch deletion fails after the directory is removed, the branch and existing registry entry remain. Resolve the branch issue and retry the same command to finish removal.

The removal follows the shared manifest commit and push behavior. If committing fails, the removal is already complete: commit only workspace.json manually instead of rerunning removal for a missing, unregistered checkout.

Prune worktrees with deleted upstreams

git workspace prune --dry-run
git workspace prune

Checks registered branch worktrees for remote upstream branches that no longer exist. It fetches each relevant remote once per repository and prunes stale remote-tracking branch refs before choosing candidates. Fetching is limited to remote branch refs; local branches and tags are not fetched into or pruned from their namespaces. A failed fetch leaves that remote's worktrees alone and makes the command exit with an error; cached missing refs alone are not enough to infer deletion.

The preview lists candidates and any commits not reachable from cached remote refs. That count can include squash-merged work; it is not proof that commits were never pushed. Removal deletes the local branch and ignored files too, just like remove. Review the list before confirming work you may still need.

Each candidate has a y/N/q prompt: y or yes removes it, Enter or n keeps it, and q or end-of-input stops. Use -f or --force to remove eligible candidates without prompting; all safety checks still apply. --dry-run takes precedence over --force and only previews candidates. Root repositories, detached worktrees, and branches without a remote upstream are never selected. Dirty, locked, and current worktrees are skipped. The actual checked-out branch and its upstream are used even if they differ from the directory's @branch name.

Prune rechecks checkout identity, branch, commit, upstream, and dirty/locked state after confirmation. If they changed, it skips removal and reports an error. It uses the normal remove path, including manifest commits and pushes, local applied tracking, and remove hooks with source: "prune". Hook discovery happens once for the prune invocation. Declined or skipped candidates do not run hooks. Individual failures are reported while other candidates can still be considered; already completed removals are retained.

--dry-run refreshes remote refs and previews candidates without prompting, removing checkouts, changing the manifest, committing, pushing, or running hooks. --no-hooks skips remove hooks for confirmed removals. An interrupted workspace pull must be resumed before prune can run.

Command hooks

Executables on PATH named git-workspace-hook-<command>-post-<name> run after add, remove, and rename, including those operations performed by pull and removals performed by prune. Installing the executables on PATH enables them; there is no hook directory, registration command, or hook configuration in the manifest.

git workspace hook list
git workspace add owner/repo --no-hooks
git workspace pull --no-hooks

hook list shows available hooks and their resolved paths, even before workspace initialization. Hooks receive the command and post as arguments and versioned JSON on stdin, including stable IDs, checkout paths before and after the operation, and its outcome. Hooks run in order and are awaited. Failures warn without rolling back the command or changing its exit status. Dry runs, help, and completion never execute hooks.

See Writing command hooks for the full protocol, npm packaging example, partial failures, and pull recovery semantics. Hooks must tolerate repeated delivery after an interrupted pull. There are no pre hooks, fetch hooks, or separate prune hooks in this version; prune uses remove hooks.

Available hooks

git-workspace-hook-tmux creates detached tmux sessions when checkouts are added, preserves running panes across renames, and closes managed sessions when checkouts are removed. Requires tmux on PATH.

npm install -g git-workspace-hook-tmux

Installation enables its add, remove, and rename hooks automatically. Sessions are never attached or switched automatically. Removing a checkout terminates its managed session and all programs running in its panes.

Errors

Failures print an error: message to stderr and exit with status 1. The label is red when stderr is a terminal; redirected output stays plain. When available, a separate hint: explains the next step:

error: cannot remove holepunchto/brittle: linked worktrees exist
hint: remove the linked worktrees first

Development

With Bare installed, run from the repository directory to install dependencies and link the local CLI:

npm install
npm link

Run the Brittle integration tests on Bare (Git must be installed):

npm test

Tests use isolated temporary workspaces and local Git repositories, disable network protocols, and clean up afterward. They do not access your real workspace or Git configuration.

Format files with Prettier and the Holepunch config:

npm run format

Lint files with Lunte:

npm run lint

The require-await rule is disabled, so async functions may omit await.

The CI workflow runs tests, lint, and formatting checks on pushes to any branch and on pull requests, using Node.js 24 and Bare.

Publishing

Create a version commit and tag, then push them:

npm version patch # or minor / major
git push --follow-tags

If push.followTags is enabled in your Git configuration, plain git push is enough.

The publish workflow checks the tagged version, then runs tests, lint, and formatting checks before publishing to npm. Stable versions publish to latest; prereleases such as 1.1.0-beta.0 publish to next. Versioning is manual, and ordinary branch pushes do not publish packages.

See the publishing guide for npm trusted publisher setup, authentication, and tag-push details.