[Git] commit message convention 커밋 메시지 컨벤션

    블리자드가 스타 1 개발할 시절 소스코드에 남겨놓은 메세지

    Git 커밋 메시지 컨벤션

    1. Git Commit Message Convention이란

    팀 협업을 위해 Git commit message 의 규칙을 정해두는 것이다. git의 커밋 히스토리를 읽는것 만으로도 변경사항을 이해할 수 있도록 commit message를 남기는 것이 중요하다.

    여러 글을 읽어보았는데 개인적으로는 Angular 의 Git 커밋 컨벤션이 가장 깔끔하다고 생각되어 이에 따라 commit message 를 기록하고자 한다.

    커밋 메시지 예제는 angular commit 이력을 통해 확인해보자.

    2. Commit message 구조

    커밋 메시지는 빈 줄로 구분된 세 부분으로 구성된다. 이 때 커밋 메시지의 제목만 필수값이며 본문과 꼬리말은 optional 입력이다.

    <type>(<scope>): <subject>
    <BLANK LINE>
    <body>
    <BLANK LINE>
    <footer>

    Type

    커밋 메시지의 제목을 입력할 때 아래의 Type 중 하나를 선택하여 commit convention을 지키도록 하자. 아래 Type 은 Angular 의 Git commit message convention이다.

    • build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
    • ci: Changes to our CI configuration files and scripts (example scopes: Travis, - Circle, BrowserStack, SauceLabs)
    • docs: Documentation only changes
    • feat: A new feature
    • fix: A bug fix
    • perf: A code change that improves performance
    • refactor: A code change that neither fixes a bug nor adds a feature
    • style: Changes that do not affect the meaning of the code (white-space, - formatting, missing semi-colons, etc)
    • test: Adding missing tests or correcting existing tests

    feat: add validating API
    feat(lang): add polish language

    Scope

    커밋 타입에 대한 추가적인 범위를 기록할 수 있도록 도와준다. Opional 입력값 이므로 선택적으로 입력한다. 예를 들면 feat(parser): add ability to parse arrays 과 같이 parser에 대해 수정하였음을 기록 가능하다.

    Subject

    제목에는 변경 사항에 대한 간략한 설명을 적는다.

    • 명령형 시제를 사용한다 : "change" not "changed" nor "changes"
    • 첫글자를 대문자로 쓰지 않는다.
    • 문장 끝에 점(.) 을 찍지 않는다

    3. 마치며

    git commit 메시지의 자세한 내용은 angular commit-message-guidelines 문서를 읽어보자. Type, Subject 만 규칙에 충실히 잘 따라도 팀 협업에 큰 도움이 된다.

    참고

    반응형

    댓글

    Designed by JB FACTORY