yeoseon / tip-archive

트러블 슈팅 및 팁을 모아두는 레포 (Today I Learned)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Commit Message Guidelines (Angular)

yeoseon opened this issue · comments

Commit Message Guidelines

Angular에서 제공하는 커밋메시지 Convension을 정리해본다.

Angular : Commit Message Guidelines 참고

Commit Message Format

다음과 같이 header, body, footer로 구성되어 있다.

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

이중 Header는 필수로 기록해야 하며, Header의 Scope는 옵션이다.
Footer에는 관련 이슈가 있다면 Closing 참조를 입력해준다. (ex) Closes #이슈번호

Samples

docs(changelog): update changelog to beta.5
fix(release): need to depend on latest rxjs and zone.js

The version in our package.json gets copied to the one we publish, and users need the latest of these.

Revert

이전 Commit으로 되돌리는 경우, 반드시 header를 revert: 로 시작해야한다.
body에는 This reverts commit <hash> 다음과 같은 내용으로 넣어주면 된다. 에는 되돌리려는 Revision 번호를 입력한다.

Type

Header의 Type 란에는 다음 중 하나의 키워드가 들어가게 된다.

build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) - 빌드 시스템이나 외부 Dependency에 대한 변경이 있을 때  
ci: Changes to our CI configuration files and scripts (example scopes: Circle, BrowserStack, SauceLabs)
docs: Documentation only changes - CI 설정이나 Script가 바뀌었을 때  
feat: A new feature - feature의 줄임말  
fix: A bug fix - bug fix  
perf: A code change that improves performance - 성능 개선
refactor: A code change that neither fixes a bug nor adds a feature - Refatoring  
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 - 테스트 코드를 추가 또는 수정할 때  

Scope

Angular에서는 영향을 미치게 되는 npm package명을 입력하도록 가이드하고 있다.
Commit 메시지로부터 생성된 changelog를 통해 이해할 수 있도록.. 이라고 되어있다.

animations
bazel
benchpress
common
compiler
compiler-cli
core
elements
forms
http
language-service
localize
platform-browser
platform-browser-dynamic
platform-server
platform-webworker
platform-webworker-dynamic
router
service-worker
upgrade
zone.js

npm package 이름을 쓰지 않아도 되는 몇가지 예외가 있다.
이는 내가 당장 쓸 일이 없으니 그냥 원문을 옮겨놓겠다.

There are currently a few exceptions to the "use package name" rule:

packaging: used for changes that change the npm package layout in all of our packages, e.g. public path changes, package.json changes done to all packages, d.ts file/format changes, changes to bundles, etc.
changelog: used for updating the release notes in CHANGELOG.md
docs-infra: used for docs-app (angular.io) related changes within the /aio directory of the repo
dev-infra: used for dev-infra related changes within the directories /scripts, /tools and /dev-infra
ngcc: used for changes to the Angular Compatibility Compiler
ve: used for changes specific to ViewEngine (legacy compiler/renderer).
none/empty string: useful for style, test and refactor changes that are done across all packages (e.g. style: add missing semicolons) and for docs changes that are not related to a specific package (e.g. docs: fix typo in tutorial).

Subject

변경에 대한 간단한 설명을 적는다.

현재형 문장을 쓰도록 한다.
문장 끝에 .을 찍지 않는다.
첫 글자를 대문자로 적지 않는다.

Body

Subject의 룰과 동일하게 현재형 문장을 쓰도록 한다.
이 Commit을 하게 된 동기를 설명하고, 앞의 상태에서 변경된 점을 적는다.

Footer

Breaking Change 에 대한 정보 및 Github의 Issue Closing 키워드를 포함해야 한다.

Breaking Changes should start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.