HdacHdac

Menu Open

search result

Frequently Searched Words
Menu Close

NEWS

Latest News

Stay updated with the latest news and event on RIZON

Developers’ Journal

Commit History를 효과적으로 관리하기 위한 규약: Conventional Commits

Feb 15th, 2020

이번에는 우리가 개발을 어떻게 진행하고 있는지 공유하는 첫번째 글을 작성해보려고 합니다. 프로젝트를 처음 시작하며 Commit Message를 어떻게 남기는 것이 좋을지 팀원들과 이야기를 나누어 보았었습니다. Commit Message Format을 크게 신경쓰지 않는 프로젝트들도 많지만, 나름의 규칙을 지닌 프로젝트들도 있습니다.

우리는 Conventional Commits 를 프로젝트에 도입해 보기로 했고, 그 과정에서 들었던 생각과 느낌을 공유해 보고자 합니다.

좋은 Commit Message란 무엇일까?

우리는 의미 단위로 코드 뭉치를 작성하고, VCS(Version Control System)에 snapshot을 찍는 행위를 Commit이라고 부릅니다. 그리고 Commit을 할 때마다 그것을 설명하는 Message를 남기게끔 되어있습니다. 작성한 Commit Message는 우리가 작성한 코드의 의미를 이해하는 단서가 되기도 하고, 프로젝트 개발의 흐름과 방향을 가늠해볼 수 있게 하기도 합니다. 이러한 용도를 고려해 볼 때 Message는 큰 흐름에서 보았을 때 Commit의 내용을 쉽게 파악할 수 있도록 간명해야 하고, 작성한 코드의 의미를 잘 설명해 주어야 한다는 것을 짐작해볼 수 있습니다.

그렇다면 좋은 Commit Message는 어떻게 작성해야 할까요? Linus Tovalds는 좋은 Commit Message에 대해서 다음과 같이 설명합니다. /svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 1 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\" stroke=\"rgba(41, 41, 1)\" /></svg>"); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">link

Header line: explain the commit in one line (use the imperative)Body of commit message is a few lines of text, explaining things    in more detail, possibly giving some background about the issue    being fixed, etc etc.The body of the commit message can be several paragraphs, and    please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.
Make sure you explain your solution and why you're doing what
you're doing, as opposed to describing what you're doing.
Reviewers and your future self can read the patch, but might
not understand why a particular solution was implemented.
Reported-by: whoever-reported-it
Signed-off-by: Your Name <youremail@yourhost.com>

Example 1-Linus’ Recommendation

Commit Message를 Header, Body 그리고 Footer 형태로 나누고, Header에는 Commit의 한 줄 요약을 명령문 형태로 작성합니다. Body에는 어떻게 구현했는지를 서술하는 것이 아니라, Issue에 대한 Background와 자신의 Solution 그리고 왜 이렇게 구현했는지 작성합니다. 마지막으로 Footer에는 Reporter와 Signer를 기록합니다.

이처럼 Message Format을 지정함으로써 개발자들은 어떤 형태로 Commit Message를 작성해야 하는지 고민하지 않아도 되고, Commit Message가 포함해야 하는 내용을 개발자들이 잘 작성하도록 유도할 수 있습니다.

Linus’ Commit Message 작성 방식은 다양한 Commit Message Format에 영향을 주었고 우리 팀은 그 중에 Conventional Commits 라는 규약을 선택하기로 하였습니다.

Conventional Commits란?

/svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 1 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\" stroke=\"rgba(41, 41, 1)\" /></svg>"); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">Conventional Commits는 /svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 1 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\" stroke=\"rgba(41, 41, 1)\" /></svg>"); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">Angular Commit Guideline에서 영감을 받아 작성된 Commit Message Specification입니다. 이 Specification의 목적은 개발자들이 /svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 1 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\" stroke=\"rgba(41, 41, 1)\" /></svg>"); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">SemVer 와 들어맞도록 Commit Message를 작성하도록 해, 프로젝트의 Semantic Version을 자동으로 결정하고, production Release시에 CHANGELOG 를 자동으로 생성하는 것 입니다. Conventional Commit Message는 아래와 같은 형태로 작성합니다.

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

Example 2-Conventional Commit Message Format

Message를 작성하는 법

  • fix: 기존 기능의 변경 없이 bug를 고치는 경우에 사용하는 type입니다. Semantic Version의 PATCH에 대응하는 Message Type입니다.
fix(release): need to depend on latest rxjs and zone.jsThe version in our package.json gets copied to the one we publish, and users need the latest of these.

Example 3-Conventional Commit Message Sample with optional scope

Example 3은 fix type이므로 Semantic Version의 PATCH 에 해당하는 변화를 의미합니다.

chore!: drop Node 6 from testing matrixBREAKING CHANGE: dropping Node 6 which hits end of life in April

Example 4-Conventional Commit Message Sample with BREAKING CHANGE

Example 4는 Body가 BREAKING CHANGE:로 시작하므로 Semantic Version의 MAJOR에 해당하는 변화를 의미합니다. BREAKING CHANGE가 body에 있음을 Headline에 표시하기 위해 type과 colon사이에 ! 를 삽입하였습니다.

feat(docs-infra): add v8 to the version picker in the navbar(#35196)The v8.angular.io should be ready shortly.PR Close #35196

Example 5-Conventional Commit Message Sample with optional footer

Close #123과 같은 meta-information은 Example 5처럼 footer에 작성합니다.

Conventional Commit Message에 대한 전체 Specification은 /svg+xml;utf8,<svg preserveAspectRatio=\"none\" viewBox=\"0 0 1 1\" xmlns=\"http://www.w3.org/2000/svg\"><line x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\" stroke=\"rgba(41, 41, 1)\" /></svg>"); background-size: 1px 1px; background-position: 0px calc(1em + 1px);">link 를 따라가면 확인할 수 있습니다.

Conventional Commits의 장점

Conventional Commit Message를 사용한 Repository의 Commit History
  • Type과 Scope 덕분에 Commit History Tree를 훑어보는 것 만으로 어떤 범위에 어떤 성격의 변경이 반영되었는지 쉽게 파악할 수 있습니다.

Conventional Commits과 함께 사용할 수 있는 유용한 Tool들

앞으로 더 풍성하고 다양한 주제로 글을 올릴 예정입니다. 많이 기대해주세요 :)

References

PRIVACY POLICY

1. Introduction.

Hdac Technology AG respects the privacy of its Members, Contributors, Users or Clients and is dedicated to controlling the use and disclosure of information provided by Members, Contributors, Users or Clients using the Site. This Privacy Policy (the “Privacy Policy”) sets forth Hdac Technology AG’s policies regarding collection, storage, access, use and disclosure of information relating to a Member’s, Contributor’s, User’s or Client’s registration and use of the Site. Any terms not defined herein shall have the meaning set forth in the Terms & Conditions, the Transaction Terms & Conditions or the User Agreement.

2. Information Collection, Use And Disclosure Activities.

2.1 Registration Information.

To ensure that only legitimate entities and individuals are able to access the non-public areas of the Site and enter into transactions, we require each potential Member, Contributor, User or Client to, by using the Registration Page on the Site, provide (i) information regarding themselves (including name, e-mail address, job title, work address and work phone number), and (ii) information regarding their Company (including Company name and parent Company’s name and address). Upon receipt of Your registration data, Hdac Technology AG may contact You or Your Company to obtain other background information used by Hdac Technology AG to evaluate an applicant's qualifications for Membership, Contribution and/or Participation. Other than as specified in this Privacy Policy, the registration information will be used only internally by Hdac Technology AG and will not be disclosed to third parties without the applicable Member’s, User’s or Client's prior written consent. Notwithstanding of the before mentioned, Hdac Technology AG is obliged to report suspicious transactions and facts about individuals including Contributors to the relevant authorities without further notification and without becoming liable for any damage such action may cause.

2.2 References.

In addition to the information specified in Section 2.1, Hdac Technology AG may require Members, Contributores, Users or Clients or prospective Members, Contributors, Users or Clients to provide Hdac Technology AG with Company references to allow Hdac Technology AG to verify a Company’s capacity, legitimacy and reputability. Hdac Technology AG may provide such references to parties with which a Member, User or Client enters into a Negotiation to assure such parties that Company can meet its prospective obligations thereunder.

2.3 Member, Contributors, User or Client Profile.

Each Member, User or Client will create a Member, Contributor, User or Client profile that includes, among other things, information about this Member, Contributor, User or Client. Information in a Member, Contributor, User or Client profile are accessible only by the applicable Member, Contributor, User or Client, the Member, User or Client’s Group Administrator and Hdac Technology AG. Certain Member, Contributor, User or Client profile information will be provided to the parties engaged in a Negotiation in accordance with Section 2.5. Other than as permitted under this Privacy Policy, Member, Contributor, User or Client profile information will not be disclosed to third parties without the applicable Member, Contributor, User or Client's prior written consent.

2.4 Member, Contributor, User or Client Information.

(a) Hdac Technology AG may collect, use and disclose both on and off the Site, for marketing and other purposes, certain general, demographic and statistical information regarding Site usage and transactions. (b) To assist Member, User or Clients in selecting companies they may do business with through the Site, Hdac Technology AG may make available to Member, Contributor, User or Clients and non-Member, Contributor, User or Clients certain performance statistics of all Companies, provided that such statistics shall not include any Company-identifiable pricing information.

2.5 Technical and Usage Information.

To operate the Site, enhance its functionality, and ensure that Members, Contributors, Users or Clients Negotiations and communications are convenient, dependable and secure, Hdac Technology AG may collect, store and use technical and Site usage information relating to a Member, Contributor, User or Client's activities on the Site. Such information includes the Internet Protocol (“IP”) address from which a Member, Contributor, User or Client accesses the Site, which is used only internally by Hdac Technology AG as required for server operation and other technical uses, and is not disclosed to Members, Contributors, Users or Clients or other persons. Hdac Technology AG may also track the pages of the Site accessed by Members, Users or Clients.

2.6 Member, Contributor, User or Client Communications.

Hdac Technology AG may use Member, Contributor, User or Client contact information, such as e-mail addresses, to communicate with Members, Users or Clients regarding registration and transactions, to notify Members, Contributors, Users or Clients of changes in Site functionality and features, product and service updates, policy changes, billing and other activities relating to a Members, Contributors, Users or Client's use of the Site, and for marketing purposes.

2.7 Legal Compliance.

In addition to the disclosures permitted pursuant to this Privacy Policy, Hdac Technology AG may provide Member, Contributor, User or Client information in connection with legal, administrative or judicial inquiries, claims or orders to the extent necessary to comply therewith or to enforce a User Agreement.

3. Collection And Use Of Information Using Cookies.

As with many state-of-the-art Internet sites, the Site uses “cookies” to enhance the functionality of the Site and to make transactions and other activities more convenient and efficient for Members, Contributors, Users or Clients. A “cookie” is a file stored locally on computers used to access the Member, Contributor, User or Client account that contains information relating to a Member, Contributor, User or Client's past use of the Site. For example, a cookie may contain information previously entered on a Site form, which may be recalled as default information when that form is accessed at a later time. This prevents re-entry of frequently used information each time a Member, Contributor, User or Client account is accessed. Cookies are also useful in streamlining log-in and in preserving transactional information between sessions. Cookies will likely play an increasingly important role as we enhance the ability of Members, Contributors, Users or Clients to customize the functionality of the Site to better meet their needs and preferences. Most Internet browsers include preference settings that allow users to be notified and control whether cookies are transferred to their computers. Please review Your browser's documentation or “help” feature for more information on that functionality. Although disabling cookies will not affect a Member, User or Client's ability to transact business on the Site, it may make such activities more time consuming.

4. Linked Sites.

The Site may contain hyperlinks through which other Internet websites may be accessed by Members, Contributors, Users or Clients. Hdac Technology AG is not responsible for and cannot make any assurances regarding privacy, or other policies or practices of the operators of such websites. Such links are provided only for the convenience of our Members, Contributors, Users or Clients, and the presence of any link does not imply that Hdac Technology AG endorses, approves or is responsible for such websites.

5. Security.

Hdac Technology AG is very concerned with the security of information relating to our Members, Contributors, Users or Clients' use of the Site and has implemented systems and procedures to prevent unauthorized access to that information including the use of Secure Sockets Layer (SSL) connection and password protection. Each Member, Contributor, User or Client will create its own username and password, the secrecy of which is the sole responsibility of the Member, Contributor, User or Client. In the event the integrity of a Member, Contributor, User or Client’s password is compromised, the Member, Contributor, User or Client shall immediately change its password.

6. Updates To The Privacy Policy.

Hdac Technology AG may update this Privacy Policy from time to time as new features and services become available on the Site and to keep pace with technological developments. The new terms shall be effective ten (10) days after they are initially posted on the Site. It is the responsibility of the Member, Contributor, User or Client to review the latest terms. If You do not agree with updated Privacy Policy, You should immediately cease use of the Site and the Services.