Sync Claude Global Settings
Sync the ~/.claude directory (global Claude Code config) with its remote repo. All git commands run against ~/.claude.
- •
Run
git -C ~/.claude fetch originto get latest remote state. - •
Run
git -C ~/.claude statusto check for local changes. - •
If there are local changes (modified or untracked files):
- •
Stage all changed files by name (do NOT use
git add -Aorgit add .) - •
Commit with a descriptive message using a HEREDOC:
bashgit -C ~/.claude commit -m "$(cat <<'EOF' Sync local Claude settings changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> EOF )"
- •
- •
Run
git -C ~/.claude pull --rebase origin mainto pull latest changes, rebasing local commits on top. - •
If the rebase has conflicts, report them to the user and stop — do NOT force-resolve.
- •
Run
git -C ~/.claude pushto push any local commits. - •
Report the result: what was pulled, what was pushed, or that everything was already in sync.
- •
Write a UTC timestamp to mark the sync time:
bashdate -u +"%Y-%m-%dT%H:%M:%SZ" > ~/.claude/last-synced-at