[Git] 커밋 컨벤션 메세지 작성하기

Kim Yuhyeon·2023년 11월 1일
0

Git

목록 보기
8/9

커밋 메세지 형식

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

유의사항

커밋 메세지의 행은 100자 이내로 간결하게 작성한다.

type

변경한 내용의 타입.
가능한 타입의 종류는 아래와 같다.

feat (feature) 
fix (bug fix)
docs (documentation)
style (formatting, missing semi colons, …)
refactor
test (when adding missing tests)
chore (maintain)

scope

커밋 변경 장소

$location, $browser, $compile, $rootScope, ngHref, ngClick, ngView, etc...

이부분이 처음에 잘 이해가 안가서 GPT한테 물어봤다..ㅎㅎ
말 그대로 변경한 장소를 쓰면 되는 거였다.
README를 수정하였다면
docs(REAMDE) 이런식~!

GPT 왈
$는 해당 변경 사항이 어떤 모듈, 서비스, 또는 컴포넌트와 관련이 있는지 나타내기 위해 사용된다고 한다.
ex.
feat($scroll): add smooth scrolling effect
여기서 $scroll 은 해당 변경이 스크롤과 관련이 있다는 것을 표시하는데 사용되었습니다. 하지만 이 규칙은 프로젝트나 팀의 커밋 메시지 스타일 가이드에 따라 다를 수 있습니다. 일반적으로는 $를 사용하지 않고도 명시적인 scope를 사용하는 것이 좋습니다.

subject

변경사항에 대한 간결한 설명

유의 사항

  • 명령형, 현재형을 사용한다.
    ex. “change” (O) / “changed” “changes” (X)
  • 첫 글자를 대문자로 하지 않는다.
  • 점을 맨 끝에 붙이지 않는다.

body

변화된 사항에 대한 동기를 작성하고, 이전 사항과 대조한다.

유의 사항

  • 명령형, 현재형을 사용한다.
    ex. “change” (O) / “changed” “changes” (X)

참고

http://365git.tumblr.com/post/3308646748/writing-git-commit-messages
http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Breaking changes 변경 사항(?)

모든 변경 사항은 변경 사항, 정당성 및 마이그레이션 노트에 대한 설명과 함께 footer에 언급되어야 한다.

BREAKING CHANGE: isolate scope bindings definition has changed and
    the inject option for the directive controller injection was removed.
    
    To migrate the code follow the example below:
    
    Before:
    
    scope: {
      myAttr: 'attribute',
      myBind: 'bind',
      myExpression: 'expression',
      myEval: 'evaluate',
      myAccessor: 'accessor'
    }
    
    After:
    
    scope: {
      myAttr: '@',
      myBind: '@',
      myExpression: '&',
      // myEval - usually not useful, but in cases where the expression is assignable, you can use '='
      myAccessor: '=' // in directive's template change myAccessor() to myAccessor
    }
    
    The removed `inject` wasn't generaly useful for directives so there should be no code using it.

참조 이슈

Close된 이슈 같은 경우 아래와 같이 언급을 해준다.

Closes #234

이슈가 여러개일 경우 쉼표를 통해 구분한다.

Closes #123, #245, #992

예시

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)
fix($compile): couple of unit tests for IE9

Older IEs serialize html uppercased, but IE9 does not...
Would be better to expect case insensitive, unfortunately jasmine does
not allow to user regexps for throw expectations.

Closes #392
Breaks foo.bar api, foo.baz should be used instead
feat(directive): ng:disabled, ng:checked, ng:multiple, ng:readonly, ng:selected

New directives for proper binding these attributes in older browsers (IE).
Added coresponding description, live examples and e2e tests.

Closes #351
style($location): add couple of missing semi colons
docs(guide): updated fixed docs from Google Docs

Couple of typos fixed:
- indentation
- batchLogbatchLog -> batchLog
- start periodic checking
- missing brace
feat($compile): simplify isolate scope bindings

Changed the isolate scope binding options to:
  - @attr - attribute binding (including interpolation)
  - =model - by-directional model binding
  - &expr - expression execution binding

This change simplifies the terminology as well as
number of choices available to the developer. It
also supports local name aliasing from the parent.

BREAKING CHANGE: isolate scope bindings definition has changed and
the inject option for the directive controller injection was removed.

To migrate the code follow the example below:

Before:

scope: {
  myAttr: 'attribute',
  myBind: 'bind',
  myExpression: 'expression',
  myEval: 'evaluate',
  myAccessor: 'accessor'
}

After:

scope: {
  myAttr: '@',
  myBind: '@',
  myExpression: '&',
  // myEval - usually not useful, but in cases where the expression is assignable, you can use '='
  myAccessor: '=' // in directive's template change myAccessor() to myAccessor
}

The removed `inject` wasn't generaly useful for directives so there should be no code using it.

적용하기

https://pgmjun.tistory.com/85

커밋 메세지 수정하기

git rebase -i HEAD~3

https://velog.io/@mayinjanuary/git-%EC%BB%A4%EB%B0%8B-%EB%A9%94%EC%84%B8%EC%A7%80-%EC%88%98%EC%A0%95%ED%95%98%EA%B8%B0-changing-commit-message

주의 사항

변경된 파일이 있으면 안된다!
stash하거나 변경 사항을 제거하고 커밋 메세지를 수정할 것
https://github.com/madplay/madplay.github.io/issues/92

참고

https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message

0개의 댓글