agentleFS
mkt-henrymkt-henry/claude-skills/skills/sync/SKILL.md

sync

Skill0 starsChanged 4 months agoMITView on GitHub

Bring the current git repo and its remote to the same, newest state — fetch, then pull / rebase / commit / push as the divergence requires. Use when the user says /sync, "sync", "원격이랑 맞춰줘", "동기화", "최신으로 맞춰줘", "pull 받고 push 해줘", or otherwise asks to reconcile local and remote.

  • Deletes or force-pushes
  • Commits and pushes

70 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use develop, scope and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • hong9LeeSkill

    develop

    빌드, 아키텍처, git 관련 작업 시 OMS MSA 공통 인프라 규칙을 적용한다. 기술 스택, 빌드 명령, 헥사고날 아키텍처 구조, git 워크플로우, AI Context 동기화 규칙을 다룬다. 코드 작성 컨벤션은 /convention, 테스트 컨벤션은 /test-guide 스킬을 참조.

    Also in 6 projects that use this

  • YuriNachosSkill

    scope

    Configure claude-scope status line widgets for Claude Code. Use when user wants to customize widgets, change theme, reorder elements, or modify display style.

    Also in 7 projects that use this

  • nicolasestremSkill

    document

    Create focused documentation for specific components or features

    Also in 5 projects that use this

  • victordelrosalSkill

    pulse

    Financial weekly pulse. Revenue vs forecast, expenses vs budget, cash position, outstanding invoices, variances. Friday morning routine. Octopus colors: Yellow (data pull) + Purple (synthesis).

    Also in 3 projects that use this

  • GoogleSkill

    briefing

    Formats the standalone daily briefing — curated picks with why-it-matters lines, community buzz, the trend read across runs, and the taste note that keeps the learning visible.

    Also in 3 projects that use this

  • kt057Skill

    check

    lint, typecheck, test を一括実行して結果をサマリーする

    Also in 6 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 10 are distinctive, and 5 are very specific to this project.

  • 0

    Common

    Most of the 61 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Run these first and base every decision on the output:

    line 12
  2. Distinctive:

    Use git rev-list, not git log, for the count — git log --count prints nothing through some shells.

    line 22
  3. Very specific:

    Read the first line of git status -sb before anything else — it reports branch, upstream, unborn state, and a deleted upstream in one shot, …

    line 24
  4. Very specific:

    No upstream at all (rev-parse '@{u}' fails).

    line 29
  5. Distinctive:

    No remote configured (git remote prints nothing) — there is nothing to sync against.

    line 30
  6. Distinctive:

    If git status --porcelain is non-empty:

    line 36
  7. Distinctive:

    Ask whether to commit them or stash them for the duration.

    line 39
  8. Distinctive:

    If committing: stage the files the user named (git add), write a commit message in the repo's existing style (check git log --oneline -20 …

    line 40
  9. Very specific:

    If stashing: git stash push -u -m "sync: <timestamp>", finish the sync, then git stash pop and report any conflicts.

    line 41
  10. Distinctive:

    Never git checkout --, git reset --hard, or git clean to get a clean tree.

    line 42
  11. Distinctive:

    If unsure which, ask. Do not guess on a shared branch.

    line 59
  12. Very specific:

    Never use git push --force or --force-with-lease unless the user explicitly asks for it in this conversation.

    line 61
  13. Distinctive:

    If the pull/rebase stops on conflicts:

    line 65
  14. Very specific:

    After resolving, run the repo's typecheck/test command if one is obvious from package.json before pushing.

    line 70
  15. Distinctive:

    If the current branch is the default branch (main/master) and the user has local commits on it, mention that the repo convention may be to …

    line 84

“Common” is measured: kept by at least 6 in 10 of the 61 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

sync — reconcile local and remote

One command that inspects the divergence between the current branch and its upstream, then does the smallest thing that leaves both sides on the same newest commit. Works in any repo. Never rewrites published history, never discards work without asking.

1. Read the state

Run these first and base every decision on the output:

git rev-parse --abbrev-ref HEAD          # current branch
git rev-parse --abbrev-ref --symbolic-full-name '@{u}'   # upstream (may fail)
git fetch --all --prune
git status --porcelain=v1 -b
git rev-list --left-right --count '@{u}...HEAD'          # behind<TAB>ahead

Use git rev-list, not git log, for the count — git log --count prints nothing through some shells.

Read the first line of git status -sb before anything else — it reports branch, upstream, unborn state, and a deleted upstream in one shot, and it succeeds in cases where rev-parse errors out. Stop and report, rather than proceeding, on any of these:

  • fatal: not a git repository — the directory is not a repo, or its .git is incomplete (a .git holding only objects, say). Nothing to sync; do not run git init to "fix" it.
  • ## No commits yet on <branch> — unborn branch. rev-parse HEAD fails and no count exists. If the remote has commits, git pull can still populate it; otherwise there is nothing to sync until the first commit.
  • ## <branch>...<upstream> [gone] — the upstream branch was deleted on the remote (usually merged and cleaned up). Counting against it fails. Tell the user, and offer either re-pointing at the default branch (git switch main && git pull) or re-publishing this one (git push -u origin <branch>). Never delete the local branch for them.
  • No upstream at all (rev-parse '@{u}' fails). Push it with git push -u origin <branch> if the user wants it published; otherwise say so and stop.
  • No remote configured (git remote prints nothing) — there is nothing to sync against.

Detached HEAD (## HEAD (no branch)) has no upstream by definition — report it and stop rather than guessing a branch name.

2. Handle uncommitted work

If git status --porcelain is non-empty:

  • Show the user the changed paths and a short git diff --stat.
  • Ask whether to commit them or stash them for the duration. Do not decide silently — uncommitted work is the user's, and the answer changes what the rest of the run does.
  • If committing: stage the files the user named (git add), write a commit message in the repo's existing style (check git log --oneline -20 for the convention — this repo family uses Conventional Commits with Korean bodies), and commit.
  • If stashing: git stash push -u -m "sync: <timestamp>", finish the sync, then git stash pop and report any conflicts.
  • Never git checkout --, git reset --hard, or git clean to get a clean tree.

3. Reconcile by divergence

Four cases, from the ahead/behind counts:

behindaheadAction
00Already in sync. Report and stop.
>00git pull --ff-only. Fast-forward, nothing else needed.
0>0git push.
>0>0Diverged — see below.

Diverged. Show both sides first (git log --oneline '@{u}..HEAD' and git log --oneline 'HEAD..@{u}'), then pick:

  • Local commits are unpushed and private → git pull --rebase, then git push. Preferred default: linear history, no merge noise.
  • Local commits are already pushed elsewhere, or the branch is shared → git pull --no-rebase (merge), then git push. Rebasing published commits rewrites history other people have.
  • If unsure which, ask. Do not guess on a shared branch.

Never use git push --force or --force-with-lease unless the user explicitly asks for it in this conversation.

4. Conflicts

If the pull/rebase stops on conflicts:

  • List the conflicted files (git diff --name-only --diff-filter=U).
  • Resolve only conflicts whose intent is unambiguous (lockfiles, generated types, an import list where both sides clearly want their line). For anything touching real logic, show both sides and ask.
  • Rebase: git rebase --continue after staging. Merge: git commit. Offer git rebase --abort / git merge --abort if the user would rather back out.
  • After resolving, run the repo's typecheck/test command if one is obvious from package.json before pushing.

5. Report

End with a short summary the user can verify at a glance:

  • branch and upstream
  • what happened (fast-forwarded / rebased N commits / merged / pushed N commits / already in sync)
  • final git log --oneline -1 for both local and @{u}, showing they match
  • anything left for the user: stash popped with conflicts, a branch with no upstream, tests not run

Notes

  • git fetch --prune deletes remote-tracking refs for branches deleted on the remote. That is local bookkeeping only — it never touches the user's local branches.
  • If the current branch is the default branch (main/master) and the user has local commits on it, mention that the repo convention may be to work on a feature branch — but still complete the sync they asked for.
  • With multiple remotes, sync against the branch's own upstream, not origin by assumption.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.