Git Workflow (GitHub Flow)

D5.0

| Branch | Role |

intermediateCoding & Developmentcodingclaude-skill
Get This Skill on GitHub

Overview


name: git-workflow description: "GitHub Flow guide. MUST invoke before starting any feature/fix implementation. Triggers: branch, commit, PR, implement, 구현, 새 기능"

Git Workflow (GitHub Flow)

Branch Strategy

BranchRole
mainAlways deployable, triggers auto-deploy
Work branchesfeature/*, fix/*, refactor/*, docs/*, chore/*

Branch Naming

PrefixPurposeExample
feature/New featurefeature/watchlist-export
fix/Bug fixfix/login-redirect
refactor/Code refactoringrefactor/api-structure
docs/Documentationdocs/api-guide
chore/Config/maintenancechore/update-deps

Workflow

1. Create Branch

git checkout main
git pull origin main
git checkout -b feature/new-feature

2. Develop & Commit

git add .
git commit -m "feat: add feature description"

3. Push & Create PR

git push -u origin feature/new-feature
gh pr create --title "feat: description" --body "## Summary\n- Changes"

4. Merge & Cleanup

gh pr merge --merge
git checkout main
git pull
git branch -d feature/new-feature

Commit Message Format

<type>: <subject>

<body> (optional)

Types

TypePurpose
featNew feature
fixBug fix
refactorRefactoring (no behavior change)
docsDocumentation only
choreConfig, deps, build
testAdd/modify tests
styleFormatting, semicolons
perfPerformance improvement

Examples

feat: add watchlist CSV export
fix: resolve login redirect issue
refactor: simplify API response handler
docs: add API documentation
chore: update dependencies

Branch Protection (main)

main 브랜치에 직접 push 금지, PR을 통해서만 머지.

GitHub 웹에서 설정

Settings > Branches > Add rule:

  • Branch name pattern: main
  • Require a pull request before merging

gh CLI로 설정

gh api repos/{owner}/{repo}/branches/main/protection -X PUT \
  -H "Accept: application/vnd.github+json" \
  --input - <<'EOF'
{
  "required_status_checks": null,
  "enforce_admins": true,
  "required_pull_request_reviews": {
    "dismiss_stale_reviews": false,
    "require_code_owner_reviews": false,
    "required_approving_review_count": 0
  },
  "restrictions": null
}
EOF

보호 규칙 확인

gh api repos/{owner}/{repo}/branches/main/protection

Exceptions

  • Typos, single-line fixes: direct commit to main allowed PR 필수
  • No dev branch needed (Preview deployment serves as staging)

Common Commands

# List branches
git branch -a

# Fetch remote
git fetch origin

# Update main
git checkout main && git pull

# Merge main into feature branch
git checkout feature/xxx
git merge origin/main

# Stash changes
git stash
git stash pop

# Undo commit (keep changes)
git reset --soft HEAD~1

# Discard file changes
git checkout -- filename

What This Skill Can Do

AI-generated examples showing real capabilities

Ready to use this skill?

Visit the original repository to get the full skill configuration and installation instructions.

View on GitHub

Related Skills