본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)107k · #773

git-workflow-and-versioning

하는 일

사용자와 AI가 만든 코드를 체계적으로 정리하도록 돕습니다. 진행 상황을 자주 저장(커밋)하고, 별도의 부분에서 작업하고(브랜치), 그 부분에 명확한 이름을 붙이도록 가르칩니다. 무언가 잘못되었을 때 쉽게 고칠 수 있도록 합니다.

사용하는 경우

  • ✓사용자나 AI가 코드를 바꿀 때마다.
  • ✓진행 상황을 저장(커밋)하거나 새 작업 흐름(브랜치)을 만들 때.
  • ✓동시에 여러 개의 서로 다른 작업을 정리해야 할 때.

스킬 링크

https://github.com/addyosmani/agent-skills/blob/main/skills/git-workflow-and-versioning/SKILL.md

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

사용 방법

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

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

Use this skill to help me: https://github.com/addyosmani/agent-skills/blob/main/skills/git-workflow-and-versioning/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개. 읽는 데 1분.

작동 방식

AI는 작은 작업 단위를 자주 저장하라고 제안합니다. '저장 지점'과 같습니다. 각 저장(커밋)은 논리적으로 한 가지 일만 해야 하며, 무엇을 했는지뿐 아니라 왜 했는지 설명하는 메시지를 가져야 합니다.

기술 내용 (원본 SKILL.md)

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

Git Workflow and Versioning

Overview

Git is your safety net. Treat commits as save points, branches as sandboxes, and history as documentation. With AI agents generating code at high speed, disciplined version control is the mechanism that keeps changes manageable, reviewable, and reversible.

When to Use

Always. Every code change flows through git.

Core Principles

Trunk-Based Development (Recommended)

Keep main always deployable. Work in short-lived feature branches that merge back within 1-3 days. Long-lived development branches are hidden costs — they diverge, create merge conflicts, and delay integration. DORA research consistently shows trunk-based development correlates with high-performing engineering teams.

main ──●──●──●──●──●──●──●──●──●──  (always deployable)
        ╲      ╱  ╲    ╱
         ●──●─╱    ●──╱    ← short-lived feature branches (1-3 days)

This is the recommended default. Teams using gitflow or long-lived branches can adapt the principles (atomic commits, small changes, descriptive messages) to their branching model — the commit discipline matters more than the specific branching strategy.

  • Dev branches are costs. Every day a branch lives, it accumulates merge risk.
  • Release branches are acceptable. When you need to stabilize a release while main moves forward.
  • Feature flags > long branches. Prefer deploying incomplete work behind flags rather than keeping it on a branch for weeks.

1. Commit Early, Commit Often

Each successful increment gets its own commit. Don't accumulate large uncommitted changes.

Work pattern:
  Implement slice → Test → Verify → Commit → Next slice

Not this:
  Implement everything → Hope it works → Giant commit

Commits are save points. If the next change breaks something, you can revert to the last known-good state instantly.

2. Atomic Commits

Each commit does one logical thing:

# Good: Each commit is self-contained
git log --oneline
a1b2c3d Add task creation endpoint with validation
d4e5f6g Add task creation form component
h7i8j9k Connect form to API and add loading state
m1n2o3p Add task creation tests (unit + integration)

# Bad: Everything mixed together
git log --oneline
x1y2z3a Add task feature, fix sidebar, update deps, refactor utils

3. Descriptive Messages

Commit messages explain the why, not just the what:

# Good: Explains intent
feat: add email validation to registration endpoint

Prevents invalid email formats from reaching the database.
Uses Zod schema validation at the route handler level,
consistent with existing validation patterns in auth.ts.

# Bad: Describes what's obvious from the diff
update auth.ts

Format:

<type>: <short description>

<optional body explaining why, not what>

Types:

  • feat — New feature
  • fix — Bug fix
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests
  • docs — Documentation only
  • chore — Tooling, dependencies, config

4. Keep Concerns Separate

Don't combine formatting changes with behavior changes. Don't combine refactors with features. Each type of change should be a separate commit — and ideally a separate PR:

# Good: Separate concerns
git commit -m "refactor: extract validation logic to shared utility"
git commit -m "feat: add phone number validation to registration"

# Bad: Mixed concerns
git commit -m "refactor validation and add phone number field"

Separate refactoring from feature work. A refactoring change and a feature change are two different changes — submit them separately. This makes each change easier to review, revert, and understand in history. Small cleanups (renaming a variable) can be included in a feature commit at reviewer discretion.

5. Size Your Changes

Target ~100 lines per commit/PR. Changes over ~1000 lines should be split. See the splitting strategies in code-review-and-quality for how to break down large changes.

~100 lines  → Easy to review, easy to revert
~300 lines  → Acceptable for a single logical change
~1000 lines → Split into smaller changes

Branching Strategy

Feature Branches

main (always deployable)
  │
  ├── feature/task-creation    ← One feature per branch
  ├── feature/user-settings    ← Parallel work
  └── fix/duplicate-tasks      ← Bug fixes
  • Branch from main (or the team's default branch)

…

자주 묻는 질문

'커밋(commit)'이란 무엇인가요?

프로젝트의 저장 지점과 같습니다. 코드의 변경 집합을 기록해, 필요하면 그 버전으로 되돌아갈 수 있게 합니다.

'브랜치(branch)'란 무엇인가요?

프로젝트의 별도 복사본과 같습니다. 주 버전에 영향을 주지 않고 새 아이디어나 수정을 시도할 수 있는 안전한 공간입니다.

작업을 자주 저장하는 것이 왜 중요한가요?

자주 저장(원자적 커밋)하면 작업을 잃지 않고, 문제를 더 쉽게 찾아 고칠 수 있습니다. 무언가 깨지면 잘 작동하던 이전 저장 지점으로 쉽게 되돌릴 수 있습니다.

상세 정보

작성자의 원본 설명

Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, splitting uncommitted work in a messy working tree into clean atomic commits, opening or reviewing a pull request (PR), pushing to a remote, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging,

repo: addyosmani/agent-skills

인기도

GitHub 스타
107k
순위
#773
라이선스
MIT
업데이트
2026. 10. 13.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬