git-sync skill
자동 stash 기능을 지원하며 merge 또는 rebase 전략을 사용하여 feature branch를 base 또는 upstream branch와 동기화합니다.
- GitHub 스타
- 8
- 파일
- 3
- 마지막 커밋
- 2026년 10월 28일
- 라이선스
- MIT
- 허용된 도구
- —
git-sync skill은 무엇을 하나요?
git-sync은(는) agent skill입니다. 자동 stash 기능을 지원하며 merge 또는 rebase 전략을 사용하여 feature branch를 base 또는 upstream branch와 동기화합니다.
skill의 SKILL.md에서 생성된 요약입니다.
git-sync skill 정보
git-sync는 Git 저장소에서 작업하는 개발자가 feature branch를 main 또는 develop branch의 최신 상태로 유지할 수 있도록 도와줍니다. base 또는 upstream branch의 변경 사항을 merge 또는 rebase 전략을 사용하여 현재 작업 중인 branch로 가져오는 프로세스를 자동화합니다. 이 도구는 공식적인 릴리스 관리나 hotfix 반영보다는 필요에 따른 수시 브랜치 업데이트를 위해 설계되었습니다.
Agent가 이 SKILL을 로드하면 git status와 git log를 사용하여 현재 branch 상태를 검사하는 것으로 시작하여 다단계 워크플로우를 수행합니다. GitHub CLI 또는 로컬 git 설정을 통해 base branch를 자동으로 감지할 수 있습니다. 데이터 손실을 방지하기 위해 --stash flag를 사용하여 동기화 전에 커밋되지 않은 변경 사항을 임시로 저장하고 프로세스가 완료되면 다시 pop할 수 있습니다. 표준 git 명령어를 기반으로 작동하며, 이미 remote에 push된 branch에 대해 rebase를 요청할 경우 특정 경고를 제공합니다.
사용자는 히스토리 재작성을 위한 --rebase, 대상 branch를 지정하는 --base, 또는 fork의 upstream remote와 동기화하는 --upstream 등의 인자를 통해 작업을 커스텀할 수 있습니다. merge 또는 rebase 도중 충돌이 발생하면 해당 SKILL은 관련 파일을 식별하고 중단하여 사용자가 수동으로 해결할 수 있도록 합니다.
agent가 수행할 수 있는 작업
- 1main branch로 feature branch 업데이트기본 merge 전략을 사용하여 현재 작업 중인 branch를 main branch와 동기화합니다.
- 2특정 branch로 rebase 수행rebase를 사용하여 develop branch의 최신 변경 사항 위에 로컬 커밋을 적용합니다.
- 3upstream으로부터 fork 동기화upstream remote의 최신 변경 사항을 로컬 fork로 가져와 최신 상태를 유지합니다.
- 4로컬 변경 사항을 유지하며 동기화오류를 방지하기 위해 커밋되지 않은 작업을 자동으로 stash하면서 branch 동기화를 수행합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
git-sync skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.플러그인에 git-sync skill 설치
/plugin marketplace add mgiovani/cc-arsenal /plugin install cc-arsenal@cc-arsenal-marketplace
Claude Code에 git-sync skill 설치
~/.claude/skills/git-sync/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/git-sync ~/.claude/skills/git-syncClaude Code (project)에 git-sync skill 설치
.claude/skills/git-sync/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/git-sync .claude/skills/git-syncCodex에 git-sync skill 설치
~/.agents/skills/git-sync/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/git-sync ~/.agents/skills/git-syncGemini CLI에 git-sync skill 설치
~/.gemini/skills/git-sync/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/git-sync ~/.gemini/skills/git-syncClaude.ai에 git-sync skill 설치
npx degit mgiovani/cc-arsenal/skills/git-sync git-sync && zip -r git-sync.zip git-sync # claude.ai → Customize → Skills → + → Create skill → Upload a skill → git-sync.zip
SKILL.md
GitHub에서 보기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 -20
Also 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: no
Phase 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 main
이 스킬의 파일
3git-sync skill 질문
Claude Code에 git-sync skill을 어떻게 설치하나요?
npx degit mgiovani/cc-arsenal/skills/git-sync ~/.claude/skills/git-sync를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
git-sync skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
특정 base branch와 브랜치를 동기화하려면 어떻게 하나요?
--base flag를 사용하여 base branch를 지정할 수 있습니다. 예: /git-sync --base develop.
이 도구를 사용하여 fork한 저장소를 원본 저장소와 동기화할 수 있나요?
네, --upstream flag를 사용하면 origin 대신 upstream remote로부터 동기화할 수 있습니다.
작업 디렉토리에 커밋되지 않은 변경 사항이 있으면 어떻게 되나요?
--stash flag를 사용하면 도구가 동기화 전에 변경 사항을 자동으로 stash하고 완료 후 다시 pop합니다.