publish
The core command of git-shadow. It strips local comments from your staged changes, creates two commits (one clean, one with comments), and cherry-picks the clean commit to the public branch.
Usage
# If you've already committed on @local
git shadow publish
# Commit and publish in one step
git shadow publish --commit -m "your commit message"
Full workflow example
# On feature/login@local — work normally
git add .
git shadow publish --commit -m "feat(auth): user login function"
# Then push the public branch normally
git push origin feature/login
What it does
- Strips local comments (matching
LOCAL_COMMENT_PATTERN, default:///) from staged files - Creates two commits on
@local:- one with your changes and local comments intact (stays in
@local) - one with only the clean code (will be cherry-picked)
- one with your changes and local comments intact (stays in
- Cherry-picks the clean commit onto the public branch
Your @local branch retains the full history including comments. The public branch gets only clean, reviewable commits.
MEMORY commits
Commits prefixed with [MEMORY] are never cherry-picked to the public branch. Use them for AI context files, local environment changes, or personal helpers.
git shadow publish --commit -m "[MEMORY] add domain model notes for AI"
After publishing
# Push to remote as usual
git push origin feature/login
Your @local branch is never pushed — it stays local by design.
Related
- commit — commit only, without publishing
- new-feature — create a new feature with both branches
- finish-feature — clean up after the MR is merged