Git Workflow Guide
커밋 메시지 형식
Conventional Commits
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Type 종류
| Type | 설명 | 예시 |
|---|
feat | 새로운 기능 추가 | feat(auth): add OAuth2 login |
fix | 버그 수정 | fix(cart): correct price calculation |
docs | 문서 변경 | docs: update API documentation |
style | 코드 포맷팅 | style: fix indentation |
refactor | 리팩토링 | refactor(user): extract validation logic |
test | 테스트 추가/수정 | test(api): add unit tests for endpoints |
chore | 빌드, 설정 등 | chore: update dependencies |
perf | 성능 개선 | perf(query): optimize database queries |
ci | CI 설정 변경 | ci: add GitHub Actions workflow |
좋은 커밋 메시지 예시
feat(payment): add Stripe payment integration
- Add Stripe SDK and configuration
- Implement checkout session creation
- Add webhook handlers for payment events
Closes #123
피해야 할 커밋 메시지
fix bug
update code
WIP
asdf
브랜치 전략
Git Flow
main (production)
└── develop
├── feature/add-login
├── feature/update-dashboard
└── bugfix/fix-payment-error
브랜치 이름 규칙
feature/<feature-name> # 새 기능
bugfix/<bug-description> # 버그 수정
hotfix/<issue> # 긴급 수정
release/<version> # 릴리스 준비
PR (Pull Request) 가이드
PR 템플릿
## 변경 사항
-
## 변경 이유
-
## 테스트
- [ ] 단위 테스트 추가/수정
- [ ] 통합 테스트 확인
- [ ] 수동 테스트 완료
## 스크린샷 (UI 변경 시)
## 관련 이슈
Closes #
PR 체크리스트
- 변경 범위가 적절한가? (너무 크면 분리)
- 테스트가 통과하는가?
- 코드 리뷰 준비가 되었는가?
- 문서 업데이트가 필요한가?
자주 사용하는 Git 명령어
# 브랜치 생성 및 이동
git checkout -b feature/new-feature
# 변경사항 확인
git status
git diff
# 커밋
git add -p # 변경사항 선택적 추가
git commit -m "feat: add new feature"
# 리베이스
git fetch origin
git rebase origin/main
# 스쿼시 (여러 커밋 합치기) - 터미널에서 직접 실행
git rebase -i HEAD~3
# 실수 복구
git reset --soft HEAD~1 # 마지막 커밋 취소 (변경사항 유지)
git stash # 임시 저장
git stash pop # 임시 저장 복구
충돌 해결
- 충돌 파일 확인:
git status
- 충돌 마커 확인 및 수정
- 수정 완료 후:
git add <file>
- 계속 진행:
git rebase --continue
Git 작업 체크리스트
커밋 전
PR 생성 전
머지 전
관련 스킬
documentation: PR 설명 작성
code-quality: 커밋 전 코드 리뷰