Skip to content

Instantly share code, notes, and snippets.

@TeamDijon
TeamDijon / context-worktree-pattern.md
Last active April 17, 2026 16:44
.context/ Worktree Pattern

.context/ Worktree Pattern

A git pattern for keeping markdown context files (docs, specs, decisions, notes) in the same repo as code but on a completely separate history.

What it is

An orphan git branch mounted as .context/ via git worktree. Context and code share the same repo but have fully separate histories. Markdown files on the context branch are accessible to both humans and AI agents alongside the codebase, without cluttering the main branch or polluting the code commit log.

Setup

@TeamDijon
TeamDijon / commit-msg.sh
Created April 19, 2026 11:05
Remove Anthropic fluff from commit messages → .git/hooks/commit-msg
#!/bin/sh
# Strip Anthropic Co-Authored-By trailers and the "Generated with Claude Code" line.
sed -i -e '/<noreply@anthropic\.com>/d' \
-e '/🤖 Generated with \[Claude Code\]/d' "$1"
# Trim trailing blank lines left behind.
sed -i -e :a -e '/^\s*$/{$d;N;ba' -e '}' "$1"