git-sync
Skill8 starsChanged 48 days agoMITView on GitHub
Syncs the current feature branch with its base or upstream branch via merge (default) or rebase, with conflict detection and stash handling. Use for ad-hoc requests like "sync my branch with main", "rebase onto main", "rebase on latest dev", "pull upstream into my fork", or "update my branch". Not for release/hotfix branch promotion or cutting versioned releases, use gitflow or git-release for those.
- Deletes or force-pushes
- Commits and pushes
7 other projects use a version of this.
Adopted by
Most recently taken up by
- IvanLi-CN/agent-toolkittheir own version, first seen Oct 15, 2026
- solplum/agent-git-workflow-skillstheir own version, first seen Oct 15, 2026
- EricTechPro/super-boardtheir own version, first seen Oct 3, 2026
- ViktorSoroka07/claude-delivery-skillstheir own version, first seen Sep 28, 2026
- Ldxs001/maby_skillstheir own version, first seen Aug 2, 2026
- ariffazil/arifOStheir own version, first seen May 11, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- EricTechPro/super-board★ 572same name
- ariffazil/arifOS★ 53same name
- kunwl123456/zeroclaw-skills-collection★ 27same name
- solplum/agent-git-workflow-skills★ 3same name
- IvanLi-CN/agent-toolkit★ 0same name
- Ldxs001/maby_skills★ 0same name
- ViktorSoroka07/claude-delivery-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository53 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-browserSkill
- anything-to-skillSkill
- ci-generateSkill
- ci-localSkill
- clotho-researchSkill
- codex-imagegenSkill
- create-ruleSkill
- create-skillSkill
- db-migrateSkill
- docker-initSkill
- docs-adrSkill
- docs-checkSkill
- docs-diagramSkill
- docs-initSkill
- docs-rfcSkill
- docs-updateSkill
- env-setupSkill
- find-skillsSkill
- fix-bugSkill
- git-commitSkill
- git-create-prSkill
- gitflowSkill
- git-releaseSkill
- i18n-checkSkill
- implement-featureSkill
- improve-skillSkill
- inject-docsSkill
- jira-cliSkill
- motion-studioSkill
- optimize-ai-setupSkill
- orchestrateSkill
- oss-launchSkill
- prd-to-issuesSkill
- product-design-specSkill
- product-design-tokensSkill
- product-prdSkill
- project-illustratorSkill
- project-plannerSkill
- refactorSkill
- renderSkill
- review-codeSkill
- review-depsSkill
- review-designSkill
- review-perfSkill
- review-planSkill
- review-securitySkill
- shipSkill
- stopslopSkill
- test-suiteSkill
- vrt-checkSkill
- wtfSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 5 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
5
Distinctive
This author's own choices. Worth a look.
1
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
- Distinctive: line 19
Run the following to understand current branch state:
- Distinctive: line 93
Stop and wait. Do not attempt automatic resolution.
- Distinctive: line 95
After a successful sync:
- Distinctive: line 96
If a stash was auto-created in Phase 2, pop it now: git stash pop.
- Distinctive: line 119
Never force push to main/master, regardless of flags or user insistence.
- Very specific: line 121
Use --force-with-lease, never bare --force, so a rebase-push can't clobber someone else's commits.
“Common” is measured: kept by at least 6 in 10 of the 4 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.
Files
Git Sync
Sync the current branch with its base or upstream branch. Defaults to merge to preserve history; rebase is opt-in only. Only ever act on what git status and git log actually show: never guess branch state or conflicts.
Workflow
Phase 1: Detect & Decide
Run the following to understand current branch state:
git branch --show-current
git status --porcelain
git remote -v
git log --oneline HEAD..origin/main 2>/dev/null | head -20
git log --oneline origin/main..HEAD 2>/dev/null | head -20Also check whether the branch is pushed to remote (git log origin/<branch>..HEAD: an error means local-only).
Determine the base branch once, and reuse the result for the rest of the run:
- User passed
--base <branch>: use it. - Otherwise
gh pr view --json baseRefName -q .baseRefName 2>/dev/null(if an open PR exists). - Otherwise
git config branch.<name>.merge. - Otherwise ask the user which base branch to use.
Determine sync strategy:
Merge (default): use when the branch has been pushed to remote, the user did not pass --rebase, or you are unsure.
Rebase (opt-in): use only when the user explicitly passed --rebase.
Fork sync (--upstream) syncs from the upstream remote instead of origin: git fetch upstream && git merge upstream/<base>.
Display the detected state and proposed strategy before proceeding:
Current branch: feature/my-feature
Base branch: main
Strategy: merge (default)
Commits behind: 5
Commits ahead: 2
Dirty tree: noPhase 2: Pre-sync Safety
- Dirty working tree: with
--stash, rungit stash push -m "git-sync auto-stash"before syncing. Without--stash, abort and tell the user to commit, stash, or re-run with--stash. - Fetch latest:
git fetch origin(andgit fetch upstreamfor fork sync). - Re-check divergence after fetch so the numbers you report are accurate, not the pre-fetch snapshot.
Phase 3: Execute & Report
Merge: git merge origin/<base>
Rebase, local-only branch: git rebase origin/<base>
Rebase, pushed branch: warn before rewriting shared history:
WARNING: This branch has been pushed to remote.
Rebasing will require a force-push, which rewrites history.
This is ONLY safe if no one else has pulled this branch.
Proceed? [y/N]If confirmed:
git rebase origin/<base>
git push --force-with-lease origin <branch>On merge/rebase conflict, do not guess how to resolve them:
git diff --name-only --diff-filter=Uto list conflicting files.- Report the exact file list, e.g.:
Conflicts in 2 files: src/api/client.ts src/api/types.ts Resolve manually, then run `git merge --continue` (or `git rebase --continue`). Or run `git merge --abort` (or `git rebase --abort`) to back out. - Stop and wait. Do not attempt automatic resolution.
After a successful sync:
- If a stash was auto-created in Phase 2, pop it now:
git stash pop. If the pop itself conflicts, report those conflicting files the same way as a merge conflict. - Gather real numbers, don't estimate:
git log --oneline -5 git log --oneline origin/<base>..HEAD | wc -l - Report, using only values from the commands above:
Include whether force-push was used, and mentionSynced feature/my-feature onto main (merge). Now 2 commits ahead of main, 0 behind. Stash popped cleanly.git rerereif conflicts occurred during this run.
Argument Parsing
--rebase: use rebase instead of merge--base <branch>: specify the base branch (default: auto-detect)--upstream: sync fromupstreamremote instead oforigin(fork workflow)--stash: auto-stash dirty changes before sync, pop after
Important Notes
- Never force push to main/master, regardless of flags or user insistence.
- Merge is the safe default for shared branches; only rebase branches you're sure are local-only or where the user explicitly accepted the force-push warning.
- Use
--force-with-lease, never bare--force, so a rebase-push can't clobber someone else's commits. - Fork workflow requires the
upstreamremote to already be configured (git remote add upstream <url>).
Examples
# Sync with main using merge (default)
/git-sync
# Sync with develop branch
/git-sync --base develop
# Rebase onto main (will warn if branch is already pushed)
/git-sync --rebase
# Sync, stashing local changes first
/git-sync --stash
# Fork sync: pull upstream changes into your fork
/git-sync --upstream --base mainDoes 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
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.

