Lecture

Common English Phrases for Git

Git is the most widely used version control system globally.

To manage versions, Git saves the source code at a specific point in time, which is called a commit.

A commit is a crucial task that records changes in the source code, and a commit message is written to describe these changes.

If you are developing a project confined to your local area, writing commit messages in your native language is permissible.

However, if you aim to advance your career by becoming a core contributor to a global open-source project or collaborating with overseas developers, it is recommended to write commit messages in proper English according to best practices.

Fortunately, writing English commit messages is much easier than writing technical documentation or emails in English.

This is because commit messages are generally written in a global standard known as Conventional Commits.

Before diving into how to write English commit messages, let's look at the structure of a commit message.


Structure of a Commit Message

A commit message is divided into a subject (title), body, and footer.

  • Subject : The title of the commit, written in a single line.

  • Body : The main section of the commit, providing detailed explanations of its purpose and changes.

  • Footer : The footer of the commit, which includes issues and references related to the commit.

Example Commit Message
git commit -m "feat: add new feature" -m "This commit adds a new feature to the project." -m "Related issue: #123" feat: add new feature This commit adds a new feature to the project. Related issue: #123

Here, the first line is the Subject of the commit message, the second line is the Body, and the third line is the Footer.

In practice, often only the Subject is written for a commit message, and the Body is only provided if detailed explanation is needed.

It is rare to include a Footer, but it is recommended when the issue tracker is linked.


Conventional Commits

Conventional commits are a set of guidelines to maintain consistency in commit message format, written as follows:

Conventional Commits Format
<type>[optional scope]: <description> [optional body] [optional footer]

Here are examples of commit messages following the conventional commit format.

Examples of Conventional Commit Messages
feat: add new feature docs: update README refactor: improve code quality

The type represents the category of the commit and may include the following values:

  • feat: Adds a new feature
  • fix: Fixes a bug
  • docs: Modifies documentation
  • style: Changes code style (non-functional)
  • refactor: Refactors code (non-functional)
  • perf: Enhances performance
  • test: Adds or modifies tests
  • chore: Miscellaneous tasks (e.g., build scripts)
  • build: Related to build changes
  • ci: Changes related to CI/CD
  • revert: Reverts a previous commit
  • merge: Merges branches
  • release: Related to deployment

Subject Writing Rules for Conventional Commits

The Subject of conventional commits follows these rules:

  • Start with an imperative verb.
  • Use lowercase letters for all words.
  • Omit periods at the end of sentences.
  • Skip articles like a and an.

Here are some examples reflecting these rules:

Subject Writing Examples for Conventional Commits
fix: remove deprecated features fix: remove obsolete features feat: add parameters to getImage feat: add parameters to getImage docs(readme): update build instructions docs(readme): update build instructions chore: update npm dependencies to latest version chore: update npm dependencies to latest version

Let's now explore commonly used English expressions related to Git that are frequently used in real-world practice.

Quiz
0 / 1

Which of the following is not a valid type in Conventional Commits?

feat

fix

chore

design

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help