본문으로 건너뛰기
Skillpedia
일반 코딩48k · #4733

git-advanced-workflows

하는 일

이 도구는 프로젝트 기록을 정리하고 깨끗하게 만들며, 오류를 빠르게 찾고, 길을 잃지 않으면서 프로젝트의 여러 부분을 동시에 작업하도록 돕습니다.

사용하는 경우

  • ✓제출하기 전에 변경 사항을 정리하고 싶을 때.
  • ✓문제를 일으킨 변경을 찾아야 할 때.
  • ✓여러 작업을 동시에 진행하고 싶을 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/git-advanced-workflows/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/git-advanced-workflows/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“마지막 5개의 커밋 기록을 정리해서 메시지를 다듬고 일부 변경을 합치려면 어떻게 해야 하나요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

고급 Git 명령을 사용해 기록을 다시 쓰고, 프로젝트 간에 특정 변경을 적용하며, 오래된 버전에서 오류를 찾습니다. 이렇게 하면 더 깔끔하고 이해하기 쉬운 기록을 만들 수 있습니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Git Advanced Workflows

Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.

Do not use this skill when

  • The task is unrelated to git advanced workflows
  • You need a different domain or tool outside this scope

Instructions

  • Clarify goals, constraints, and required inputs.
  • Apply relevant best practices and validate outcomes.
  • Provide actionable steps and verification.

When to Use

  • Cleaning up commit history before merging
  • Applying specific commits across branches
  • Finding commits that introduced bugs
  • Working on multiple features simultaneously
  • Recovering from Git mistakes or lost commits
  • Managing complex branch workflows
  • Preparing clean PRs for review
  • Synchronizing diverged branches

Repository and Recovery Boundary

Read repository instructions and branch protection first. A hotfix follows the protected PR/maintainer path when required; urgency does not authorize a direct default-branch commit or push. Preserve dirty and staged work before checkout, rebase, reset or restore. A backup branch protects committed history only, not uncommitted files. Inspect exact targets before destructive operations and obtain authorization for shared-history rewrites. Reflog availability depends on local expiry and garbage collection; it cannot guarantee recovery of every lost file.

Core Concepts

1. Interactive Rebase

Interactive rebase is the Swiss Army knife of Git history editing.

Common Operations:

  • pick: Keep commit as-is
  • reword: Change commit message
  • edit: Amend commit content
  • squash: Combine with previous commit
  • fixup: Like squash but discard message
  • drop: Remove commit entirely

Basic Usage:

# Rebase last 5 commits
git rebase -i HEAD~5

# Rebase all commits on current branch
git rebase -i $(git merge-base HEAD main)

# Rebase onto specific commit
git rebase -i abc123

2. Cherry-Picking

Apply specific commits from one branch to another without merging entire branches.

# Cherry-pick single commit
git cherry-pick abc123

# Cherry-pick range of commits (exclusive start)
git cherry-pick abc123..def456

# Cherry-pick without committing (stage changes only)
git cherry-pick -n abc123

# Cherry-pick and edit commit message
git cherry-pick -e abc123

3. Git Bisect

Binary search through commit history to find the commit that introduced a bug.

# Start bisect
git bisect start

# Mark current commit as bad
git bisect bad

# Mark known good commit
git bisect good v1.0.0

# Git will checkout middle commit - test it
# Then mark as good or bad
git bisect good  # or: git bisect bad

# Continue until bug found
# When done
git bisect reset

Automated Bisect:

# Use script to test automatically
git bisect start HEAD v1.0.0
git bisect run ./test.sh

# test.sh should exit 0 for good, 1-127 (except 125) for bad

4. Worktrees

Work on multiple branches simultaneously without stashing or switching.

# List existing worktrees
git worktree list

# Add new worktree for feature branch
git worktree add ../project-feature feature/new-feature

# Add worktree and create new branch
git worktree add -b bugfix/urgent ../project-hotfix main

# Remove worktree
git worktree remove ../project-feature

# Prune stale worktrees
git worktree prune

5. Reflog

Your safety net - tracks all ref movements, even deleted commits.

# View reflog
git reflog

# View reflog for specific branch
git reflog show feature/branch

# Restore deleted commit
git reflog
# Find commit hash
git checkout abc123
git branch recovered-branch

# Restore deleted branch
git reflog
git branch deleted-branch abc123

Practical Workflows

Workflow 1: Clean Up Feature Branch Before PR

# Start with feature branch
git checkout feature/user-auth

# Interactive rebase to clean history
git rebase -i main

# Example rebase operations:
# - Squash "fix typo" commits
# - Reword commit messages for clarity
# - Reorder commits logically
# - Drop unnecessary commits

# Force push cleaned branch (safe if no one else is using it)
git push --force-with-lease origin feature/user-auth

Workflow 2: Apply Hotfix to Multiple Releases

# Create fix on an authorized topic branch from the current target
git fetch origin main
git switch -c hotfix/security origin/main
git commit -m "fix: critical security patch"

# Apply to release branches

…
자주 묻는 질문

「인터랙티브 리베이스」란 무엇인가요?

다른 사람들이 보기 전에 커밋(저장된 변경)을 편집하고 재배열하는 방법입니다. 커밋을 합치거나, 이름을 바꾸거나, 삭제할 수 있습니다.

「체리픽」이란 무엇인가요?

다른 변경 사항을 함께 옮기지 않고, 프로젝트의 한 곳에서 다른 곳으로 특정 변경만 복사하는 것과 같습니다.

'git bisect'란 무엇인가요?

프로젝트의 기록을 똑똑하게 검색해서 어떤 변경이 오류나 버그를 만들었는지 정확히 찾아내는 도구입니다.

상세 정보

작성자의 원본 설명

Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#4733
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬