How do I update a worktree to latest main?

Table of Contents

Bringing a worktree up to date is more than git pull: the vcpkg submodule, generated .claude/settings.json, and the deployed skills bundle all need to move in lockstep with main. compass bearings surfaces drift in each of these (see "Is the environment up?").

Question

How do I update a worktree to the latest main, including its vcpkg submodule, settings, and skills?

Answer

# 1. Fetch latest main and check it out as a detached HEAD — this
#    checkout tracks a feature branch or task, not main itself, so we
#    never fast-forward a real branch by surprise.
git fetch origin main
git checkout --detach origin/main

# 2. Sync the vcpkg submodule to the commit main's tree records.
git submodule update --init vcpkg

# 3. Rebuild settings.json from its org source.
./projects/ores.compass/compass.sh build --direct settings

# 4. Rebuild the deployed skills bundle.
./projects/ores.compass/compass.sh build --direct skills

Then, in the Claude Code session, run /reload-skills to pick up the rebuilt bundle.

Check the result with compass bearings — the "Is the environment up?" section warns if .env, vcpkg, or settings/skills are still stale.

Script

Wrapped end-to-end by the devops-update-environment skill.

Tested by

Manual smoke test: run the sequence on a worktree with a stale vcpkg pointer, confirm git submodule status vcpkg matches git rev-parse origin/main:vcpkg afterwards, and that compass bearings no longer warns.

See also

Emacs 29.3 (Org mode 9.6.15)