git-sync-main

Synchronize local main with origin/main via fast-forward pull.

Updated Nov 2, 2025
One-click install
npx skills add https://github.com/3balljugglerYu/ai_coordinate --skill git-sync-main
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-sync-main
Source: https://github.com/3balljugglerYu/ai_coordinate/tree/main/.agents/skills/git-merge
Command: npx skills add https://github.com/3balljugglerYu/ai_coordinate --skill git-sync-main

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the process of synchronizing your local main branch with its remote counterpart (origin/main) after a merge, ensuring a clean and safe post-merge state.

Core Features & Use Cases

  • Fast-forward Pull: Updates your local main branch to match origin/main using a fast-forward merge.
  • Safe Branch Cleanup: Automatically deletes your local branch only if the corresponding remote branch has already been removed.
  • Safety First: Prevents accidental data loss by stopping if the working tree is dirty, if the current branch is main, or if the remote branch still exists.

Quick Start

Use the git-sync-main skill to synchronize your local main branch with the remote.

Frequently Asked Questions about git-sync-main

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

FAQPage Schema
How do I safely sync my local main branch with origin/main after a merge?

To safely sync your local main branch, use a fast-forward pull to update main with origin/main. The process includes safety checks to prevent data loss by stopping if your working tree is dirty or if you are currently on the main branch.

What is the safest way to clean up local branches after merging?

Safe branch cleanup automatically deletes your local branch only if the corresponding remote branch has already been removed. This safety check prevents data loss by ensuring you do not delete local branches that still exist on the remote repository.

Why does my local main branch sync fail when I have uncommitted changes?

Your local main branch sync fails because the safety checks detect a dirty working tree. This mechanism prevents data loss and unintended operations by stopping the synchronization process before executing a fast-forward pull.

Can I run git branch cleanup while staying on the main branch?

No, you cannot run branch cleanup while on the main branch. The safety checks explicitly stop the operation if the current branch is main, preventing unintended operations and ensuring a clean post-merge state.

When do I need to use a fast-forward pull for git branch synchronization?

You need a fast-forward pull when you want to update your local main branch to match origin/main without creating extra merge commits. This approach maintains a clean project history after completing a remote merge.

Does git-sync-main delete local branches if the remote branch still exists?

No, git-sync-main does not delete local branches if the remote branch still exists. It implements safety checks to only remove local branches after confirming the corresponding remote branch has been deleted, preventing accidental data loss.