Programming

[Git] Git Commit Message Conventions

jay-dev 2023. 6. 26. 19:15

Format

  • 제목,본문,꼬리말로 나누고 각각은 빈줄로 구분
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

Type

  • feat : (feature) 새로운 기능 추가
  • fix : (bug fix) 버그 수정
  • docs : (documentation) 문서 수정
  • design : 스타일링, css 수정
  • dir : 폴더 구조 구성, 변경
  • style : (formatting, missing semi colons, …) 코드 포맷팅, 세미콜론 누락, 코드 변경 x
  • refactor : 리팩토링
  • test : (when adding missing tests) 테스트 코드 추가
  • chore : (maintain) 기타 수정 (빌드, 패키지 매니저)

Subject

  • 명령조 현재시제 사용 “changed” 나 “changes”가 아닌 “change”사용
  • 첫 글자 대문자 x
  • 마지막에 마침표 x

Body

  • 명령조 현재시제 사용
  • 변경에 대한 동기나 이전 행동과의 차이 포함
  • 꼬리말은 optional이고 이슈 트래커 ID를 작성
  • 꼬리말은 "유형: #이슈 번호" 형식으로 사용
  • 여러 개의 이슈 번호를 적을 때는 쉼표(,)로 구분
  • 이슈 트래커 유형은 다음 중 하나를 사용
    -Fixes: 이슈 수정중 (아직 해결되지 않은 경우)
    -Resolves: 이슈를 해결했을 때 사용
    -Ref: 참고할 이슈가 있을 때 사용
    -Related to: 해당 커밋에 관련된 이슈번호 (아직 해결되지 않은 경우)
    ex) Fixes: #45 Related to: #34, #23

Example

feat($browser): onUrlChange event (popstate/hashchange/polling)
 
Added new event to $browser:
- forward popstate event if available
- forward hashchange event if popstate not available
- do polling when neither popstate nor hashchange available
 
Breaks $browser.onHashChange, which was removed (use onUrlChange instead)
feat: "회원 가입 기능 구현"

SMS, 이메일 중복확인 API 개발

Resolves: #123
Ref: #456
Related to: #48, #45

AngularJS 참고