Skip to main content

Worktree Workflow

Worktree Workflow

Core Principle

Main project directories ALWAYS stay on main branch (not development).

Note: Our workflow uses main as the default branch. The development branch is NOT used in this workflow. See Branch Naming Rules for details.

Project Directories (Always on Main)

OpenAPI & Design

  • $LLM_ROOT/technical-guide

Core Services

  • $LLM_ROOT/agent-buildkit
  • $LLM_ROOT/gitlab_components

Drupal Site

  • $LLM_ROOT/llm-platform

Drupal Custom Code

  • $LLM_ROOT/all_drupal_custom/recipes/llm_platform
  • $LLM_ROOT/all_drupal_custom/recipes/secure_drupal
  • $LLM_ROOT/all_drupal_custom/themes/llm_platform_manager
  • $LLM_ROOT/all_drupal_custom/modules/*

NPM Packages

  • $LLM_ROOT/common_npm/studio-ui
  • $LLM_ROOT/common_npm/agent-*
  • $LLM_ROOT/common_npm/*

Models

  • $LLM_ROOT/models/*

Workflow Steps

1. Create Issue in GitLab

Create issue describing the work.

2. Create MR from Issue

Click "Create merge request" in GitLab UI.

3. Fetch and Create Worktree

cd /path/to/main/project git fetch origin git worktree add ../worktrees/<branch-name> <branch-name> cd ../worktrees/<branch-name>

4. Work in Worktree

Make changes, commit, push to MR branch.

5. After MR Merges

# Remove worktree git worktree remove ../worktrees/<branch-name> # Return to main project directory cd /path/to/main/project # Pull latest main changes git pull origin main

Quick Commands

Setup Worktree

git fetch origin && \ git worktree add ../worktrees/<branch> <branch> && \ cd ../worktrees/<branch>

Cleanup After Merge

cd /path/to/main/project && \ git worktree remove ../worktrees/<branch> && \ git pull origin main

Verification

Always verify main directory is on main:

cd /path/to/main/project git branch --show-current # Should show: main