Appearance
skip-worktree — Local Config Flag Quick Reference
Mark / unmark
bash
# Protect a local config file (use this, not --assume-unchanged)
git update-index --skip-worktree config/local.yaml
# Unprotect
git update-index --no-skip-worktree config/local.yaml
# Wrong flag — assume-unchanged (does not survive checkout/merge)
git update-index --assume-unchanged large-file.bin
git update-index --no-assume-unchanged large-file.binInspect
bash
# List all flagged files (S = skip-worktree, h = assume-unchanged)
git ls-files -v | grep -E '^(S|h)'
# Check a specific file
git ls-files -v config/local.yaml
# Show actual diff of a skip-worktree file
git diff HEAD -- config/local.yamlCI one-liners
bash
# CI gate — fail if any flagged files exist
git ls-files -v | grep -q -E '^(S|h)' && { echo "Flagged files found"; exit 1; }
# CI runner — inject secrets into config, protect it
echo "KEY=$SECRET" > config/deploy.yaml && git update-index --skip-worktree config/deploy.yaml
# Pre-commit drift detection
git ls-files -v | grep '^S' | awk '{print $2}' | while read f; do
git diff --quiet HEAD -- "$f" || { echo "$f differs"; exit 1; }
doneTemplate sync
bash
# Pull upstream changes while keeping local overrides
git update-index --no-skip-worktree config/local.yaml
git stash
git pull
git stash pop
git update-index --skip-worktree config/local.yamlFlag comparison
| Action | --assume-unchanged | --skip-worktree |
|---|---|---|
git status ignores | Yes | Yes |
git add . stages | No | No |
git checkout overwrites | Yes | No |
git pull overwrites | Yes | No |
git diff HEAD shows | No | Yes |
| Use case | Performance (big files, never change) | Config (tracked template, local edits) |
Key config
No Git config keys — flags are per-file index state, set via git update-index.