Athena โ€” mahmoud-consultancy/archive/old-docs/WORKTREE_QUICKSTART.md

Git Worktrees - Quick Start Guide

TL;DR: Werk aan meerdere branches tegelijk zonder te switchen!


๐Ÿš€ Snelle Setup (2 minuten)

Stap 1: Run het setup script

cd /Users/sarkout/projects/prive/mahmoud-consultancy
./setup-worktrees.sh

Dit maakt 3 worktrees aan:

  • ../mahmoud-consultancy-glorylabs โ†’ GloryLabs website werk
  • ../mahmoud-consultancy-sessions โ†’ InterimPlaza sessions
  • ../mahmoud-consultancy-kb โ†’ Knowledge Base development

Stap 2: Open in VS Code (optioneel)

# Open elk worktree in apart window
code /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
code /Users/sarkout/projects/prive/mahmoud-consultancy-sessions
code /Users/sarkout/projects/prive/mahmoud-consultancy-kb

Stap 3: Work in parallel!

Terminal 1: GloryLabs

cd /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
cd website/glorylabs
# Edit, test, deploy
git add .
git commit -m "feat: update website"
git push

Terminal 2: InterimPlaza Sessions

cd /Users/sarkout/projects/prive/mahmoud-consultancy-sessions
./run-sessions-auto.sh
# Let sessions run while you work on other stuff

Terminal 3: Knowledge Base

cd /Users/sarkout/projects/prive/mahmoud-consultancy-kb
cd backend/
# Develop KB features

๐Ÿ“‹ Belangrijkste Commando's

# List worktrees
git worktree list

# Add worktree manually
git worktree add -b <branch-name> <path> <base-branch>

# Remove worktree
git worktree remove <path>

# Cleanup
./cleanup-worktrees.sh

โœ… Voordelen

Zonder worktrees:

git checkout feature-1    # Work on feature 1
git checkout feature-2    # Lose feature 1 context
git checkout main         # Lose feature 2 context
# Constant switching, context loss

Met worktrees:

Terminal 1: cd mahmoud-consultancy-glorylabs   # Feature 1
Terminal 2: cd mahmoud-consultancy-sessions     # Feature 2
Terminal 3: cd mahmoud-consultancy-kb           # Feature 3
# All active simultaneously!

๐ŸŽฏ Use Cases voor Dit Project

Use Case 1: GloryLabs Deployment + InterimPlaza Development

# Terminal 1: Deploy GloryLabs
cd ../mahmoud-consultancy-glorylabs
cd website/glorylabs
./deploy.sh

# Terminal 2: Run InterimPlaza sessions (ondertussen!)
cd ../mahmoud-consultancy-sessions
./run-sessions-auto.sh

Use Case 2: Multiple Features Simultaneously

# Terminal 1: Website updates
cd ../mahmoud-consultancy-glorylabs

# Terminal 2: Backend API development
cd ../mahmoud-consultancy-kb

# Terminal 3: Frontend components
cd ../mahmoud-consultancy-sessions

Use Case 3: Testing Different Approaches

# Try approach A in one worktree
cd ../mahmoud-consultancy-glorylabs

# Try approach B in another worktree
cd ../mahmoud-consultancy-kb

# Compare results, pick best approach

๐Ÿงน Cleanup Na Merge

./cleanup-worktrees.sh

Of manually:

# List worktrees
git worktree list

# Remove one
git worktree remove ../mahmoud-consultancy-glorylabs

# Prune stale references
git worktree prune

โš ๏ธ Belangrijke Regels

  1. Commit voordat je wisselt - Elke worktree is een working directory
  2. Eรฉn branch per worktree - Kan niet dezelfde branch in 2 worktrees hebben
  3. Push regelmatig - Backup je werk
  4. Clean up na merge - Verwijder worktrees die je niet meer nodig hebt

๐Ÿ†˜ Troubleshooting

"Branch is already checked out"

# Check welke worktree de branch heeft
git worktree list

# Remove die worktree eerst
git worktree remove <path>

"Uncommitted changes"

cd <worktree>
git status
git add .
git commit -m "wip: save work"
# Of
git stash

"Worktree not found"

# Prune stale references
git worktree prune

# Repair if needed
git worktree repair

๐Ÿ“– Meer Informatie

Lees WORKTREE_STRATEGY.md voor:

  • Detailed workflow examples
  • Advanced gebruik
  • Integration met session scripts
  • Best practices

๐ŸŽฏ Quick Start - Recommended Setup

Voor jouw project, recommended:

# 1. Setup worktrees
./setup-worktrees.sh

# 2. Open VS Code windows
code ../mahmoud-consultancy-glorylabs    # Voor GloryLabs website
code ../mahmoud-consultancy-sessions     # Voor InterimPlaza sessions
code .                                   # Main repo voor algemeen werk

# 3. Work in parallel
# - GloryLabs deployment in worktree 1
# - InterimPlaza sessions in worktree 2
# - Quick fixes in main repo

Ready? Run ./setup-worktrees.sh om te beginnen!

Reacties

Nog geen reacties