git에 commit을 하면서 한참 commit message를 어떻게 작성하면 좋을지를 한참 생각하다가 commit 작성 규칙을 다른 사람들은 어떻게 정하는지 한번 알아봤다. Go! Go!
일단 구글링 하였을 때 가장 많이 나오는 Udacity Git Commit Message Style Guide에 대해 알아보도록 하자
해당 사이트 (https://udacity.github.io/git-styleguide/)를 참고
commit 메시지는 한줄을 띄우는 것으로 분리된 영역들로 구성된다. title은 반드시 있어야되며, 나머지 body와 footer은 없어도 된다. 아래와 같이 생겼다.
type: Subject
body
footer
title 부분은 메시지와 주제의 Type으로 구성되어진다.
제목은 50자를 넘지 않아야 하며 대문자로 시작해야 하며 마침표로 끝나서는 안 됩니다.
명령 어조를 사용하여 커밋이 무엇을 했는지보다는 커밋이 무엇을 하는지 설명해야된다. 예를 들어, change를 사용해야 한다. changed이나 changes은 좋지 않다.
모든 커밋이 body를 작성해야 할 만큼 복잡한 것은 아니므로 선택 사항이며 commit에 약간의 설명이 필요할 때만 사용된다.
Body에는 어떻게 commit 했는지가 아니라, 무엇을 commit 했는지 왜 했는지에 대해서 설명한다.
Body를 쓸때는, Title과 Body 사이에 공백 한줄이 요구된다 그리고 각 줄의 길이를 72자 이내로 제한해야 한다.
Resolves: #1234
See also: #1235, #1236
Resolves : 문의나, 요청에 의한 이슈에 해당하는 경우 이슈 번호
Closes : 일반적인 개발과 관련된 이슈에 해당하는 경우 이슈 번호
Fixes : 버그 픽스, 핫 픽스 관련 이슈에 해당하는 경우 이슈 번호
See also : 커밋의 이슈와 연관되어 있는 이슈들이 존재 하는 경우, 또는 관련된 이슈들이 있는 경우 이슈 번호
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 consequences 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
이렇게 일관되고 체계적으로 commit을 작성해야지만 프로젝트 진행중에 이전의 기록을 어렵지 않게 알아볼 수 있다.
날짜별로 마구잡이로 작성했던 commit은 이제 버리고
어떤 기능을 추가하였고 어떤 것을 수정하였는지 정확히 작성해서 project를 좀 더 똑똑하게 개발하자!!