mj-agent-git-sync

Merge latest develop or main changes into the current Git working branch.

1|Updated Mar 4, 2026
One-click install
npx skills add https://github.com/MJ-AgentLab/mj-agent --skill mj-agent-git-sync-mj-agentlab
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mj-agent-git-sync
Source: https://github.com/MJ-AgentLab/mj-agent/tree/main/.claude/skills/mj-agent-git-sync
Command: npx skills add https://github.com/MJ-AgentLab/mj-agent --skill mj-agent-git-sync-mj-agentlab

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Keeping a feature branch up to date with a fast-moving develop or main branch is error-prone: developers forget to fetch, merge the wrong base, hit conflicts without a plan, or accidentally rebase against project policy. This Skill automates the entire branch-sync workflow in the mj-agent repository with guardrails and human checkpoints. ## Core Features & Use Cases - Three sync modes: dev-time sync (work branch merges origin/develop or origin/main), hotfix back-sync (develop merges origin/main after a hotfix release), and self-update (any branch pulls its own origin counterpart for multi-machine or collaborator scenarios). - Automatic environment detection: derives the correct base branch from the current branch prefix (feature/bugfix/documentation/maintain use develop; hotfix uses main) and blocks cross-branch merges on main. - Structured conflict handling: presents divergence counts and incoming commits before merging, proposes conflict resolutions for user approval, and supports stash/pop around the merge. - Use Case: A teammate pushed new commits to develop while you were mid-feature. Ask to sync your branch, and the Skill fetches origin, shows how far behind you are, merges origin/develop, and helps resolve any conflicts before you continue. ## Quick Start Ask the assistant to sync the latest develop changes into my current working branch in mj-agent.

Frequently Asked Questions about mj-agent-git-sync

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

FAQPage Schema
How do I sync my feature branch with the latest develop changes?▼

Run the sync workflow from your feature branch: it fetches origin, shows how many commits develop is ahead, then merges origin/develop into your branch. Uncommitted changes are handled first via commit or stash, and conflicts are resolved with your approval.

Should I use git merge or rebase to update my branch?▼

This project enforces merge over rebase for team collaboration safety, consistent history, and avoiding force pushes. If you request a rebase, the workflow redirects you to a merge-based sync instead.

Can I merge main into my branch or sync while on main?▼

Cross-branch merges on main are hard-blocked by policy. The only exception is a self-update pulling origin/main into local main, for example after a release PR is merged.

How do I sync a hotfix from main back into develop?▼

Switch to develop and trigger the hotfix back-sync mode, which merges origin/main into develop and pushes the result to both remotes. This keeps develop current with production hotfixes.

What happens if the merge produces conflicts?▼

The workflow lists conflicted files, analyzes each conflict region, and proposes a resolution for your approval before staging anything. You can accept, modify, skip per region, or abort the merge entirely to restore the pre-sync state.

Why does git say I am not inside a work tree in a bare worktree setup?▼

This indicates config drift where the worktree lacks a config.worktree file, so git falls back to the bare config. The workflow can auto-repair it by writing core.bare=false and the worktree path into the worktree config.