티스토리 뷰

반응형

이 포스팅은 Udacity Git Commit Message Style Guide를 참고하여 작성 했습니다. ☞ Udacity Git Commit Message Style Guide

개요

git의 Commit Mesage (커밋 메시지)가 많이 누적 될 경우 가독성이 떨어지고 특히 여러 사람과 개발을 같이 할 때는 더욱 심각 해집니다. 협업하는 사람들 간의 커밋 메시지 스타일을 정해두면 서로간의 코드 리뷰의 도움이 될 뿐만 아니라, 자신의 이전 로그를 살펴보는 것에도 도움이 됩니다. 아래에서 설명할 내용은 Udacity의 깃 커밋 스타일 가이드입니다.

메시지 구조

커밋 메시지는 세가지 파트로 나누고 각 파트는 빈줄을 두어서 구분합나다.

type: subject

body(옵션)

footer(옵션)
  • type : 어떤 의도로 커밋했는지를 type에 명시합니다. 자세한 사항은 아래서 설명하겠습니다.
  • subject : 최대 50글자가 넘지 않도록 하고 마침표는 찍지 않습니다. 영문으로 표기하는 경우 동사(원형)을 가장 앞에 두고 첫글자는 대문자로 표기합니다. 
  • body: 긴 설명이 필요한 경우에 작성합니다. 어떻게 했는지가 아니라, 무엇했는지 작성합니다. 최대 75글자를 넘기지 않도록 합니다.
  • footer : issue tracker ID를 명시하고 싶은 경우에 작성합니다.

타입 type

  • feat : 새로운 기능 추가
  • fix : 버그 수정
  • docs : 문서의 수정
  • style : (코드의 수정 없이) 스타일(style)만 변경(들여쓰기 같은 포맷이나 세미콜론을 빼먹은 경우)
  • refactor : 코드를 리펙토링
  • test : Test 관련한 코드의 추가, 수정
  • chore : (코드의 수정 없이) 설정을 변경

커밋 메시지 예제

feat: Summarize changes in around 50 characters or less

More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.

Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequenses of this
change? Here's the place to explain them.

Further paragraphs come after blank lines.

 - Bullet points are okay, too

 - Typically a hyphen or asterisk is used for the bullet, preceded
   by a single space, with blank lines in between, but conventions
   vary here

If you use an issue tracker, put references to them at the bottom,
like this:

Resolves: #123
See also: #456, #789


반응형
댓글