Datum: 16 Oktober 2025
Current Branch: rename-to-glorylabs
Purpose: Parallel werken aan meerdere features/issues tegelijk
Git worktrees laten je meerdere branches tegelijk uitchecken in verschillende directories. Dit betekent dat je aan meerdere features/fixes kunt werken zonder constant te hoeven switchen tussen branches.
Main repo: /mahmoud-consultancy (rename-to-glorylabs branch)
Worktree 1: /mahmoud-consultancy-glorylabs-website (glorylabs-website branch)
Worktree 2: /mahmoud-consultancy-interimplaza-kb (knowledge-base branch)
Worktree 3: /mahmoud-consultancy-backend-api (backend-fixes branch)
/Users/sarkout/projects/prive/mahmoud-consultancy
├── Branch: rename-to-glorylabs
├── Focus: General updates, rebrand werk
└── Status: Je huidige werk met uncommitted backend changes
Location: /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
├── Branch: feature/glorylabs-website (nieuw)
├── Focus: GloryLabs website deployment & polish
├── Files: website/glorylabs/*
└── Work: Deployment, testing, content updates
Location: /Users/sarkout/projects/prive/mahmoud-consultancy-platform
├── Branch: feature/interimplaza-sessions (of bestaande sessie branch)
├── Focus: InterimPlaza platform development (sessions 1-17)
├── Files: frontend/, backend/, cv-service/
└── Work: Sprint 4-5 sessies
Location: /Users/sarkout/projects/prive/mahmoud-consultancy-kb
├── Branch: feature/knowledge-base (nieuw)
├── Focus: Knowledge base backend & frontend
├── Files: backend/ (Article entities), frontend/ (KB components)
└── Work: Sessions 5-15 (KB development)
Location: /Users/sarkout/projects/prive/mahmoud-consultancy-docs
├── Branch: docs/updates (nieuw)
├── Focus: Documentation updates, planning docs
├── Files: *.md, docs/, 00-Dashboard/, etc.
└── Work: Documentation, session plans, reports
Eerst moeten we de uncommitted changes opruimen:
# Optie A: Commit huidige werk
git add backend/
git commit -m "wip: article controller updates"
# Optie B: Stash voor later
git stash push -m "backend article updates"
# Optie C: Create worktree for current work
# (zie hieronder)
# Vanaf main directory
cd /Users/sarkout/projects/prive/mahmoud-consultancy
# Worktree 1: GloryLabs Website
git worktree add -b feature/glorylabs-website \
../mahmoud-consultancy-glorylabs \
rename-to-glorylabs
# Worktree 2: InterimPlaza Platform
git worktree add -b feature/interimplaza-platform \
../mahmoud-consultancy-platform \
rename-to-glorylabs
# Worktree 3: Knowledge Base
git worktree add -b feature/knowledge-base \
../mahmoud-consultancy-kb \
rename-to-glorylabs
# Worktree 4: Documentation
git worktree add -b docs/updates \
../mahmoud-consultancy-docs \
rename-to-glorylabs
git worktree list
Output zal zijn:
/Users/sarkout/projects/prive/mahmoud-consultancy 1989477 [rename-to-glorylabs]
/Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs a1b2c3d [feature/glorylabs-website]
/Users/sarkout/projects/prive/mahmoud-consultancy-platform a1b2c3d [feature/interimplaza-platform]
/Users/sarkout/projects/prive/mahmoud-consultancy-kb a1b2c3d [feature/knowledge-base]
/Users/sarkout/projects/prive/mahmoud-consultancy-docs a1b2c3d [docs/updates]
cd /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
# Werk aan website
cd website/glorylabs
# Edit files, test, etc.
# Commit changes
git add website/glorylabs/
git commit -m "feat: update GloryLabs website with AI section"
# Push naar remote
git push origin feature/glorylabs-website
cd /Users/sarkout/projects/prive/mahmoud-consultancy-platform
# Werk aan platform
./run-sessions-auto.sh # Run session scripts
# Commit changes
git add frontend/ backend/
git commit -m "feat: complete session 4 - admin navigation"
# Push
git push origin feature/interimplaza-platform
cd /Users/sarkout/projects/prive/mahmoud-consultancy-kb
# Werk aan KB
cd backend/
# Create entities, services, controllers
# Commit
git add backend/src/main/java/nl/glorylabs/
git commit -m "feat: add Article entity and repository"
# Push
git push origin feature/knowledge-base
Geen git checkout nodig! Gewoon cd naar de worktree:
# Werk aan GloryLabs website
cd /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
# Switch naar InterimPlaza platform
cd /Users/sarkout/projects/prive/mahmoud-consultancy-platform
# Switch naar KB development
cd /Users/sarkout/projects/prive/mahmoud-consultancy-kb
# Back to main repo
cd /Users/sarkout/projects/prive/mahmoud-consultancy
Elk directory is een complete git repo met zijn eigen branch!
# Ga naar main repo
cd /Users/sarkout/projects/prive/mahmoud-consultancy
# Update main branch
git checkout main
git pull origin main
# Merge feature branch
git merge feature/glorylabs-website
git push origin main
# Of maak PR via GitHub
gh pr create --base main --head feature/glorylabs-website \
--title "feat: GloryLabs website deployment" \
--body "Complete GloryLabs website with all features"
rename-to-glorylabsmain (of merge direct)git worktree list
# Remove worktree directory
rm -rf /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
# Clean up git references
git worktree prune
# Or use remove command
git worktree remove ../mahmoud-consultancy-glorylabs
# If you moved a worktree directory
git worktree repair
git worktree lock ../mahmoud-consultancy-platform --reason "Active development"
# Main repo: Blijft voor algemeen werk
cd /Users/sarkout/projects/prive/mahmoud-consultancy
# Branch: rename-to-glorylabs
# Use for: General updates, small fixes
# Worktree 1: GloryLabs Website
git worktree add -b glorylabs-website \
../mahmoud-consultancy-glorylabs \
rename-to-glorylabs
# Use for: GloryLabs website deployment & updates
# Worktree 2: InterimPlaza Sessions
git worktree add -b interimplaza-sessions \
../mahmoud-consultancy-sessions \
rename-to-glorylabs
# Use for: Running the 17 InterimPlaza sessions
# Worktree 3: Website Polish (both sites)
git worktree add -b website-polish \
../mahmoud-consultancy-websites \
rename-to-glorylabs
# Use for: Both GloryLabs AND InterimPlaza website work
# Worktree per component/feature:
# Backend only
git worktree add -b backend-api ../mahmoud-consultancy-backend rename-to-glorylabs
# Frontend only
git worktree add -b frontend-ui ../mahmoud-consultancy-frontend rename-to-glorylabs
# Websites only
git worktree add -b websites ../mahmoud-consultancy-sites rename-to-glorylabs
# DevOps/Infrastructure
git worktree add -b devops ../mahmoud-consultancy-infra rename-to-glorylabs
feature/glorylabs-website, fix/backend-api)git worktree remove)# Open elk worktree in apart window
code /Users/sarkout/projects/prive/mahmoud-consultancy
code /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
code /Users/sarkout/projects/prive/mahmoud-consultancy-platform
Elke VS Code window heeft:
Wanneer feature branch is gemerged:
# Remove worktree
git worktree remove ../mahmoud-consultancy-glorylabs
# Delete branch (local)
git branch -d feature/glorylabs-website
# Delete branch (remote)
git push origin --delete feature/glorylabs-website
# Prune references
git worktree prune
# Je probeert een branch te checken die al in een worktree is
# Oplossing: Use een andere branch of remove de existing worktree eerst
git worktree list # See where branch is checked out
git worktree remove <path> # Remove if needed
# Worktree has uncommitted changes
# Oplossing: Commit or stash first
cd <worktree-path>
git add .
git commit -m "wip: save work"
# Or
git stash
cd <worktree-path>
git fetch origin
git pull origin <branch-name>
Ik maak een script om worktrees makkelijk op te zetten:
#!/bin/bash
# setup-worktrees.sh
MAIN_DIR="/Users/sarkout/projects/prive/mahmoud-consultancy"
BASE_BRANCH="rename-to-glorylabs"
cd "$MAIN_DIR"
echo "Setting up worktrees..."
# GloryLabs Website
if [ ! -d "../mahmoud-consultancy-glorylabs" ]; then
git worktree add -b glorylabs-website \
../mahmoud-consultancy-glorylabs \
$BASE_BRANCH
echo "✓ GloryLabs worktree created"
else
echo "✗ GloryLabs worktree already exists"
fi
# InterimPlaza Sessions
if [ ! -d "../mahmoud-consultancy-sessions" ]; then
git worktree add -b interimplaza-sessions \
../mahmoud-consultancy-sessions \
$BASE_BRANCH
echo "✓ InterimPlaza worktree created"
else
echo "✗ InterimPlaza worktree already exists"
fi
# Knowledge Base
if [ ! -d "../mahmoud-consultancy-kb" ]; then
git worktree add -b knowledge-base \
../mahmoud-consultancy-kb \
$BASE_BRANCH
echo "✓ Knowledge Base worktree created"
else
echo "✗ Knowledge Base worktree already exists"
fi
echo ""
echo "Worktrees setup complete!"
echo ""
git worktree list
# Terminal 1: Work on GloryLabs website
cd /Users/sarkout/projects/prive/mahmoud-consultancy-glorylabs
code . # Open in VS Code
cd website/glorylabs
# Edit, test, commit
# Terminal 2: Run InterimPlaza session
cd /Users/sarkout/projects/prive/mahmoud-consultancy-sessions
./run-sessions-auto.sh
# Let it run while you work on website
# Terminal 3: Quick backend fix
cd /Users/sarkout/projects/prive/mahmoud-consultancy-kb
cd backend/
# Fix bug, commit
All running in parallel, no conflicts!
cd /Users/sarkout/projects/prive/mahmoud-consultancy
# Merge website work
git merge glorylabs-website
# Merge platform work
git merge interimplaza-sessions
# Merge KB work
git merge knowledge-base
# Push everything
git push origin rename-to-glorylabs
# Setup worktree voor sessions
git worktree add -b sessions-sprint4 \
../mahmoud-consultancy-sessions \
rename-to-glorylabs
# Ga naar worktree
cd ../mahmoud-consultancy-sessions
# Run sessions
./run-sessions-auto.sh
# Sessions runnen in deze worktree terwijl je aan GloryLabs werkt in main repo!
Total for 4 worktrees: ~2 GB
# List worktrees
git worktree list
# Add worktree
git worktree add <path> <branch>
# Add worktree with new branch
git worktree add -b <new-branch> <path> <base-branch>
# Remove worktree
git worktree remove <path>
# Prune deleted worktrees
git worktree prune
# Lock worktree
git worktree lock <path>
# Unlock worktree
git worktree unlock <path>
# Repair broken worktrees
git worktree repair
# Move to different worktree
cd <worktree-path>
Commit uncommitted backend changes:
git add backend/
git commit -m "wip: article controller and entity updates"
Create GloryLabs worktree:
git worktree add -b glorylabs-website \
../mahmoud-consultancy-glorylabs \
rename-to-glorylabs
Create InterimPlaza sessions worktree:
git worktree add -b interimplaza-sessions \
../mahmoud-consultancy-sessions \
rename-to-glorylabs
Work in parallel:
cd <worktree-path>
git status # Check for uncommitted changes
git log --oneline -5 # Check commits
git push # Push to remote
# All worktrees share git history
# Pushing any branch backs up that work
# Main repo .git/ has everything
# To backup: just push all branches
git push origin --all
Als je niet veel worktrees wilt:
# Just 2 worktrees:
# Main repo: GloryLabs website werk
# Worktree 1: InterimPlaza sessions
git worktree add -b sessions ../mahmoud-consultancy-sessions rename-to-glorylabs
This gives you:
Ready to setup? Run the commands above or use the setup script!
Reacties