Aegis uses git worktrees for isolated development. Each feature gets its own directory with its own branch, preventing conflicts and keeping the main repo clean.
- Isolated development β work on multiple features simultaneously without branch conflicts
- Clean main repo β main
developandmainbranches stay deployable - Fast context switching β switch between features without stashing or merging
- No cross-contamination β changes in one worktree can't accidentally affect another
docs/<topic> # Documentation changes
feat/<issue-number>-<short-description> # New features
fix/<issue-number>-<short-description> # Bug fixes
refactor/<area> # Code refactoring (no behavior change)
chore/<topic> # Tooling, CI, dependencies
Examples:
docs/api-reference-update
feat/1698-route-middleware
fix/1750-cli-auth-token
refactor/session-manager
git fetch origin develop:developgit checkout -b feat/my-new-feature origin/develop# Create worktree at ~/projects/aegis-my-feature
git worktree add ~/projects/aegis-my-feature feat/my-new-featurecd ~/projects/aegis-my-feature
npm installYou're now developing in an isolated directory.
# 1. Make your changes
cd ~/projects/aegis-my-feature
vim src/some-file.ts
# 2. Commit (conventional commits)
git add .
git commit -m "feat: add new feature"
# 3. Push your branch
git push -u origin feat/my-new-feature
# 4. Open PR via GitHub CLI
gh pr create --repo OneStepAt4time/aegis \
--base develop \
--head feat/my-new-feature \
--title "feat: add new feature" \
--body "## Summary\n\n..."# Build
npm run build
# Run tests
npm test -- --run
# Start the server (for manual testing)
node dist/server.jsAfter your PR is merged, remove the worktree:
git worktree remove ~/projects/aegis-my-featuregit branch -d feat/my-new-feature
git push origin --delete feat/my-new-feature# List active worktrees
git worktree list
# List local branches (should not show your feature branch)
git branchWrong:
git checkout -b feat/my-feature # Uses stale origin/developRight:
git fetch origin develop:develop
git checkout -b feat/my-feature origin/developIf you push a branch, it gets deleted (via squash merge or manual deletion), the worktree reference becomes stale:
git worktree list
# Shows: /path/to/worktree ABC1234... (branch was deleted)Fix:
git worktree pruneYou can't remove the worktree if you're inside it:
# You're in ~/projects/aegis-feature β can't remove it from here
git worktree remove ~/projects/aegis-feature
# Error: cannot lock
# Switch to main repo first
cd ~/projects/aegis
git worktree remove ~/projects/aegis-featureIf your worktree is months old and develop has moved far ahead:
# Rebase your worktree branch on latest develop
git fetch origin develop
git rebase origin/develop
# If conflicts occur, resolve them and continue:
git rebase --continueRunning npm install in multiple worktrees at the same time can corrupt node_modules. Run them sequentially, not in parallel.
# Create worktree
git worktree add ~/projects/aegis-<name> <branch-name>
# List worktrees
git worktree list
# Remove worktree
git worktree remove ~/projects/aegis-<name>
# Prune stale worktree references
git worktree prune
# Switch to a worktree
cd ~/projects/aegis-<name>
# Clean up merged branch
git branch -d <branch-name>
git push origin --delete <branch-name>- Always use worktrees β never develop directly in
~/projects/aegis - Branch from
origin/developβ fetch first to ensure latest - PRs target
developβ nevermain(except release merges) - Clean up after merge β remove worktree and branch promptly
- One PR per feature β batch related changes, but keep PRs focused