컬쥐네 다락방
AngularJS commit conventions - 커밋 메시지 본문
AngularJS commit conventions
우테코 프리코스 1주차 과제가 공개되고 commit convention과 Java convention을 공부하고 있습니다. :)
항상 github Desktop만 사용했는데 이번 기회에 연습용 Repo를 하나 파서 터미널을 이용한 깃 공부도 병행할 생각이에요!
이 글은 The AngularJS commit conventions을 보고 공부하며 정리한 내용입니다.
영어로 된 글이라 정리해두면 편할 것 같아서 기록해요 :)
The AngularJS commit conventions
목표
스크립트로 CHANGELOG.md를 작성하기.
git bisect를 사용하여 중요하지 않은 커밋을 무시하게 하기 (formatting같이 중요하지 않은 커밋)
git bisect란?
커밋의 특정 범위 내에서 이진 탐색을 통해 문제가 발생한 최초의 커밋을 찾는데 도움을 주는 git의 기능.
알고리즘에서 공부했던 것처럼 정상적으로 작동했었던 커밋을 지정해주면 최근 커밋과 정상커밋의 사이를 이진 탐색으로 돌아다니면서 어떤 커밋 이후에 에러가 발생했는지 찾아준다!
CHANGELOG.md
변경 내역에는 다음과 같은 내용이 포함된다.
- new features (새로운 특징)
- bug fixes (버그 수정)
- breaking changes (주요 변경 내용)
배포하면서 스크립트를 사용해 관련 커밋에 대한 링크와 위 내용들을 생성할 수 있다. 실제로 배포하기 전에 변경 내역을 수정하고 배포도 가능!
최근 배포 이후의 제목(subject) 목록을 출력하기
git log <last tag> HEAD --pretty=format:%s
이번 배포의 새로운 특징을 출력하기
git log <last release> HEAD --grep feature
중요하지 않은 커밋 식별하기
중요하지 않은 커밋을 주로 변화가 없는 커밋이다. formetting 변화 (공백이나 빈 줄의 추가, 제거, 들여쓰기), 세미콜론 누락, 주석 등등.. 이런 중요하지 않은 커밋은 이진 탐색할 때 제외하도록 할 수 있다.
git bisect skip $(git rev-list --grep irrelevant <good place> HEAD)
히스토리를 조회할 때 더 많은 정보를 제공하기
문서에서는 최근 커밋된 잘못된 내용들을 예시로 보여줬다.
- Fix small typo in docs widget (tutorial instructions)
- Fix test for scenario.Application - should remove old iframe
- docs - various doc fixes
- docs - stripping extra new lines
- Replaced double line break with single when text is fetched from Google
- Added support for properties in documentation
이런 메시지들은 어떤 변경이 발생했는지 명시하려 했지만 공통적인 규약이 없다.
- fix comment stripping
- fixing broken links
- Bit of refactoring
- Check whether links do exist and throw exception
- Fix sitemap include (to work on case sensitive linux)
이런 메시지들은 메시지만 보고는 어느 부분이 변했는지 알 수 없다.
따라서 docs, docs-parser, compiler, scenario-runner 같이 어디가 변경됐는지 알려주는게 좋다.
커밋 메시지의 형식
제일 중요한 부분! 커밋 메시지의 형식이다.
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
커밋 메시지의 각 줄은 100자를 넘기지 말아야한다. 그래야 읽기 쉽다. (찾아본 바로는 예전에는 터미널에서 볼 수 있는 글자가 최대 100자였다는 소리가 있다.. 한 눈에 볼 수 없는 문서는 읽기 어려웠을테니..)
Subject
<type>에 들어갈 수 있는 항목들
- feat : 새로운 기능 추가
- fix : 버그 수정
- docs : 문서 관련
- style : 스타일 변경 (포매팅 수정, 들여쓰기 추가, …)
- refactor : 코드 리팩토링
- test : 테스트 관련 코드
- chore : 나머지 자잘한 수정 사항
** Angualar 9 규약에서는 chore가 삭제되고 다음 3가지 항목이 추가됐다고 한다.
- build : 빌드 관련 파일 수정
- ci : CI 설정 파일 수정
- perf : 성능 개선
<scope>에 들어갈 수 있는 항목들
- 어디가 변경됐는지 작성한다.
예를 들어 $location, $browser, $compile, $rootScope, ngHref, ngClick, ngView 등등..
- 명령문, 현재 시제로 작성 (ex. 변경됐을 때 "change"를 사용한다. "changed"나 "changes"가 아니라)
- 첫글자를 대문자로 쓰지 않는다. 항상 소문자로
- 마지막에 마침표(.)를 붙이지않는다.
Massage Body (내용)
- 명령문, 현재 시제로 작성하기
- 변경한 이유와 변경 전과의 차이점을 설명하기
Massage Footer (하단)
- 주요 변경 내역을 변경점, 변경 사유, migration 지시와 함께 하단에 언급한다.
다음은 변경된 예시!
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.
해결된 이슈
해결된 이슈는 커밋 메시지 하단에 Closes #<이슈번호> 와 같이 적어서 이슈를 닫아준다.
Closes #1
이슈가 여러개인 경우 :
Closes #1, #2, #5
** Angualar 9 규약에서는'Fixes' 라는 단어를 사용하기도 한다.
Fixes #<이슈번호>
처음 나왔던 형식을 다시 살펴보면
BREAKING CHANGE: <주요 변경 내역>
<BLANK LINE>
<변경점 + migration 지시>
<BLANK LINE>
<BLANK LINE>
Closes #<이슈번호>
(혹은 Fixes #<이슈번호>)
당장 내가 다 적용할 순 없겠지만, 하나씩 하나씩 적용해보면서 익숙해지자 !
사이트 예시 :
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.
'웹 개발 > Java,Spring' 카테고리의 다른 글
getById()와 findById()의 차이점 (0) | 2021.09.03 |
---|---|
Flyway를 이용한 DB 초기화 (0) | 2021.08.07 |
JWT와 OAuth 차이점 (2) | 2021.07.05 |
RESTful API 란? (0) | 2021.06.29 |
Spring MVC 란? (0) | 2021.06.14 |