Automatically sync with GitHub at session start and remind Claude to push/pull changes as it works. Triggers on session start, reactivation, or when working in git repositories.
View on GitHubFolly-Partners/claudesync
claudesync
skills/github-sync/SKILL.md
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/Folly-Partners/claudesync/blob/main/skills/github-sync/SKILL.md -a claude-code --skill github-syncInstallation paths:
.claude/skills/github-sync/# github-sync - Session Git Synchronization
Ensures Claude Code sessions stay synchronized with GitHub, preventing lost work and merge conflicts across machines.
## When to Use This Skill
**AUTOMATICALLY TRIGGER** once per day at session start:
- The script self-limits to once every 24 hours
- Use `--force` flag to bypass the daily limit
- After completing a significant milestone (use --force)
## Session Start Routine
**At session start**, run this check (auto-skips if already run today):
```bash
# Quick git health check - automatically finds all repos in ~/
# The actual script scans for .git directories up to 4 levels deep
for dir in $(find ~ -maxdepth 4 -name ".git" -type d | xargs dirname); do
if [ -d "$dir/.git" ]; then
echo "=== Git status for $dir ==="
cd "$dir"
git fetch origin 2>/dev/null
# Check for uncommitted changes
if [ -n "$(git status --porcelain)" ]; then
echo "WARNING: Uncommitted changes detected"
git status --short
fi
# Check for unpushed commits
UNPUSHED=$(git log origin/main..HEAD --oneline 2>/dev/null | wc -l | tr -d ' ')
if [ "$UNPUSHED" != "0" ]; then
echo "WARNING: $UNPUSHED unpushed commit(s)"
fi
# Check if behind remote
BEHIND=$(git log HEAD..origin/main --oneline 2>/dev/null | wc -l | tr -d ' ')
if [ "$BEHIND" != "0" ]; then
echo "NOTICE: $BEHIND commit(s) to pull from remote"
fi
fi
done
```
## What to Do Based on Status
### If behind remote:
```bash
git pull origin main
```
Tell user: "Pulled X new commits from GitHub."
### If uncommitted changes exist:
Ask user: "There are uncommitted changes from a previous session. Should I commit them or review first?"
### If unpushed commits exist:
Ask user: "You have X commits that haven't been pushed to GitHub. Push now?"
### If everything is clean:
Silently proceed with the session (don't mention git is clean unless asked).
## Ongoing Work Reminders
### While Working in a Git Repository
**After co