Skip to content

Manage worktrees from registered bare repositories - #18

Merged
nnutter merged 11 commits into
mainfrom
repos
Aug 9, 2026
Merged

Manage worktrees from registered bare repositories#18
nnutter merged 11 commits into
mainfrom
repos

Conversation

@nnutter

@nnutter nnutter commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Now stores bare repos under $XDG_DATA_HOME (e.g., ~/.local/share/git-wt/repos) rather than even having a "main" worktree. Creates on-demand worktrees under $GIT_WT_WORKTREE_ROOT (default ~/worktrees).

nnutter added 10 commits August 9, 2026 15:07
Drop the required main worktree model. Store bare repos under
$XDG_DATA_HOME/git-wt/repos/<name>.git and create on-demand worktrees
under $GIT_WT_WORKTREE_ROOT (default ~/worktrees).

Add repo add/list/remove, --repo/--current (or interactive picker) on
worktree commands, rewrite migrate to register bare + rehome all
worktrees, remove off, and update the zsh wrapper accordingly.

Migrate configures bare origin fetch tracking like repo add, and
repository names are normalized by stripping a trailing .git suffix.
Move the lipgloss table border and cell styling used by worktree list
into newOutputTable so other commands can reuse the same presentation.
Render git-wt repo list with the same bordered table style as
git-wt list, using Name and Path columns.
Replace a leading $HOME prefix with ~ when rendering bare repository
paths in git-wt repo list.
Have the zsh wrapper leave the worktree before remove runs and cd to
$HOME afterward. Warn when remove deletes the current directory.
When cwd is inside a managed worktree, list/prune/remove resolve the
registered repo automatically so --current is only needed on create.
When migrate registers a plain clone that only has a clean checkout of
origin/HEAD, keep the bare repo only and drop the source tree instead of
creating a managed default-branch worktree.

Have the zsh wrapper cd to HOME after migrate as well as remove, so the
shell does not stay in a path migrate may have deleted or moved.
Git porcelain paths on macOS often use /private/var while constructed
paths use /var. Compare and walk paths via canonical form so managed
worktree detection, empty-parent cleanup, and bare-repo checks agree.
Show repository name in git-wt list. Outside a managed worktree, or with
--all, include every registered repository; inside a worktree, scope to
that repository unless --all or --repo is given.
Register cobra flag completion for --repo on create/list/remove/prune.
Fix the zsh completer to declare _arguments state variables, complete
list --all, nested worktree names for switch/remove, and repo remove
names.
@nnutter
nnutter enabled auto-merge August 9, 2026 21:43
git init --bare keeps HEAD on init.defaultBranch (often master on
GitHub Actions) even after only main is pushed. Set HEAD to main so
clones, migrate, and remote set-head --auto behave the same locally
and in CI.
@nnutter
nnutter merged commit 6ec4194 into main Aug 9, 2026
1 check passed
@nnutter
nnutter deleted the repos branch August 9, 2026 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant