Overview
Repo Manager organizes repositories using a bare repository with multiple worktrees. This structure enables parallel work, instant context switching, and no stashing workflow.Default Base Directory
All repositories are stored under$REPO_BASE_DIR, which defaults to $HOME/repos. You can customize this by setting the environment variable:
github.com/user/repo→$REPO_BASE_DIR/github.com/user/repo/gitlab.com/org/project→$REPO_BASE_DIR/gitlab.com/org/project/
Structure After repo get
When you run repo get github.com/user/repo, the following structure is created:
Components
The .bare/ Directory
This is a bare git repository containing all git objects, refs, and configuration:
remote.origin.fetch = +refs/heads/*:refs/remotes/origin/*for proper fetching- Standard origin URL
- Worktree metadata in
.bare/worktrees/
The Root .git File
Unlike standard repositories where .git is a directory, here it’s a file containing:
.bare/ as the git directory. It’s created during clone (functions/clone.zsh:39) and convert (functions/convert.zsh:33).
Worktree Subdirectories
Each branch gets its own subdirectory named after the branch:.git file in each worktree contains:
Example: Multiple Worktrees
After creating several worktrees:How Commands Use This Layout
Finding Repository Root
Commands likerepo wt add need to find the repository root. They use resolve_repo_root() which walks up directories looking for .bare/ (functions/core.zsh:16-27):
Detecting Default Branch
The default branch is determined from the bare repository’s HEAD (functions/core.zsh:29-38):Listing Worktrees
Converting Standard Clones
If you have an existing repository with standard layout:repo convert transforms it to:
- Detects current branch
- Moves
.git/→.bare/ - Creates
.gitfile pointing to.bare - Moves all working files into
<branch>/subdirectory - Registers worktree with git
- Configures upstream tracking
Path Resolution
Repo Manager normalizes repository paths:$REPO_BASE_DIR/github.com/user/repo/
See functions/core.zsh:1-14 for path cleaning logic.