git-sync

Sync the current branch with origin/main and resolve merge conflicts.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/generic-automation-and-it/smooth-ai-stockanalysis --skill git-sync-generic-automation-and-it
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: git-sync
Source: https://github.com/generic-automation-and-it/smooth-ai-stockanalysis/tree/main/.agents/skills/git-sync
Command: npx skills add https://github.com/generic-automation-and-it/smooth-ai-stockanalysis --skill git-sync-generic-automation-and-it

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Keeping a feature branch up to date with origin/main involves repetitive fetch-and-merge steps, and merge conflicts force you to choose between manual resolution and risky automation. This Skill wraps the deterministic fetch+merge plumbing in a script with clear sentinel outputs, so the agent only handles the decision-making part. ## Core Features & Use Cases - Safe Sync Mode: Fetches origin/main and merges non-interactively, reporting MERGE_OK with recent commits or stopping with a list of conflicting files for manual resolution. - Auto-Resolve Mode: With --fix or --auto-resolve, the agent reads each conflicting file, resolves it using a defined priority strategy, stages the results, and commits the merge. - Clear Error Separation: Distinguishes real content conflicts (MERGE_CONFLICTS) from non-conflict failures like dirty trees, missing refs, or failing hooks (MERGE_ERROR), preventing incorrect resolution attempts. - Use Case: Before opening a pull request, run the sync to pull the latest main into your feature branch; if conflicts appear, either resolve them yourself or let the agent merge both sides while preserving your branch's structure. ## Quick Start Ask the agent to sync my current branch with origin/main and stop if there are conflicts, or add the --fix flag to have conflicts resolved automatically.

Frequently Asked Questions about git-sync

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync my current branch with origin/main?▼

Run the safe-sync.sh script, which fetches origin/main and merges it into your current branch non-interactively with --no-edit. It prints MERGE_OK with the last five commits on success, or MERGE_CONFLICTS with the list of unmerged files.

How to auto-resolve git merge conflicts with AI?▼

Invoke the skill with the --fix or --auto-resolve argument. The script leaves conflicts in the working tree, and the agent reads each file, resolves it by keeping your branch's logic while incorporating main's changes, stages the files, and commits the merge.

What is the difference between MERGE_CONFLICTS and MERGE_ERROR?▼

MERGE_CONFLICTS (exit 1) means actual content conflicts exist and the files are left unmerged in the working tree for resolution. MERGE_ERROR (exit 2) means a non-conflict failure such as a dirty tree, missing ref, or failing hook, which must be reported, never resolved.

Can I sync against a branch other than origin/main?▼

Yes, the safe-sync.sh script accepts an optional base-ref argument, defaulting to origin/main. Pass a different ref such as origin/develop to fetch and merge from that branch instead.

Why does the sync script fail with a dirty working tree?▼

Git refuses to merge when uncommitted local changes could be overwritten, so the script reports MERGE_ERROR and exits with code 2. Commit or stash your changes first, then rerun the sync.