How to write good git commit messages: best practices and examples
GitHub μ»€λ° λ©μμ§ μμ± μλ Ή λ³΄κ³ μ
1. μ»€λ° λ©μμ§λ?
GitHub λλ Gitμ μ¬μ©νλ κ°λ°μμ μ»€λ° λ©μμ§λ μμ€ μ½λ λ³κ²½ μ¬νμ λͺ©μ κ³Ό λ΄μ©μ μ€λͺ νλ λ©μμ§μ λλ€. μ»€λ° λ©μμ§λ₯Ό μ μμ±νλ©΄ νμ€ν 리 κ΄λ¦¬, νμ , λ²μ κ΄λ¦¬ μλν λ±μ ν° λμμ΄ λ©λλ€.
2. μ’μ μ»€λ° λ©μμ§μ 쑰건
- 무μμ λ³κ²½νλμ§ λͺ νν
- μ λ³κ²½νλμ§ κ°λ¨ν
- μΌκ΄λ νμμΌλ‘ μμ±
- κ°λ₯νλ©΄ μμ΄ λλ ν΅μΌλ νκΈ ν€ μ¬μ©
3. μ»€λ° λ©μμ§ μμ± νμ (κΆμ₯)
Conventional Commits ν¬λ§·
<type>(optional scope): <message>
μ£Όμ Prefix (type)
νμ | μ€λͺ | μμ |
---|---|---|
feat |
μλ‘μ΄ κΈ°λ₯ μΆκ° | feat: λ€ν¬λͺ¨λ κΈ°λ₯ μΆκ° |
fix |
λ²κ·Έ μμ | fix: λ‘κ·ΈμΈ μλ¬ μμ |
docs |
λ¬Έμ κ΄λ ¨ λ³κ²½ | docs: README μμ |
style |
μ½λ ν¬λ§·ν (κΈ°λ₯ X) | style: μΈλ―Έμ½λ‘ ν΅μΌ |
refactor |
리ν©ν λ§ (κΈ°λ₯ λ³ν μμ) | refactor: μ€λ³΅ ν¨μ μ κ±° |
test |
ν μ€νΈ μ½λ μΆκ° | test: μ λ ν
μ€νΈ μμ± |
chore |
λΉλ, μ€μ , ν¨ν€μ§ κ΄λ¦¬ λ± | chore: ESLint μ€μ μΆκ° |
4. μ€μ μμ (sunbang123 μ€νμΌ κ°μ )
κΈ°μ‘΄:
add new posting about processing engineering
new post upload (κΉ μλ² μ΄μ)
contents μ¬μ
λ‘λ
μ 보μ²λ¦¬κΈ°μ¬ μ€κΈ° κΈ°μΆ μ 리
κ°μ :
docs: μ 보μ²λ¦¬κΈ°μ¬ μ€κΈ° κΈ°μΆ μ 리 ν¬μ€νΈ μΆκ°
feat: κΉ μλ² μ΄μ κ΄λ ¨ μ κ· ν¬μ€νΈ μ
λ‘λ
chore: κΈ°μ‘΄ ν¬μ€νΈ λ΄μ© μ¬μ
λ‘λ λ° λ¦¬ν¬λ§·
μ½ν μΈ μ€μ¬ μ»€λ° μμ:
docs: μ 보μ²λ¦¬κΈ°μ¬ μ€κΈ° ν¬μ€νΈ μ
λ‘λ
docs: ν¬μ€νΈ μ΄λ―Έμ§ κ²½λ‘ μμ
chore: κ²μκΈ νκ·Έ μ
λ°μ΄νΈ
5. μ»€λ° λ©μμ§ μμ± μλ Ή μμ½
μλ Ή | μ€λͺ |
---|---|
1οΈβ£ 무μ + μ | λ¨μν βμμ ν¨β λ§κ³ μ΄μ λ ν¬ν¨ |
2οΈβ£ prefix μ¬μ© | feat: , fix: λ± λͺ
νν νκ·Έλ‘ μμ |
3οΈβ£ λͺ©μ μ€μ¬ μμ± | λ¨μν νμΌλͺ λ³΄λ€ λ³κ²½ λͺ©μ μμ± |
4οΈβ£ κ΄λ ¨ μμ λ¬ΆκΈ° | κ΄λ ¨ μλ νμΌλ§ ν¨κ» μ»€λ° |
5οΈβ£ κ°κ²°νκ³ μΌκ΄λκ² | β~νμ΅λλ€β λ³΄λ€ β~μΆκ°β, β~μ κ±°β λ± μΆμ² |
6. μ λͺ μ€νμμ€ μμ (μ½λ‘ μ€νμΌ μ¬μ©)
νλ‘μ νΈ | μ»€λ° μμ |
---|---|
Angular | fix(router): handle null route |
Vue.js | feat(ssr): support custom directives |
TypeScript | refactor: simplify type checking logic |
VS Code | chore: update dependencies |
Next.js | feat(next/image): add AVIF support |
7. SEO κ΄μ μμμ μ»€λ° λΈλ‘κ·Έ μμ± ν
Git κ΄λ ¨ μ»€λ° λ©μμ§ μμ±λ²μ λΈλ‘κ·Έλ‘ μ 리ν λ, λ€μ μμλ€μ κ³ λ €νλ©΄ κ²μ λ ΈμΆ(SEO)μ λ μ 리ν©λλ€.
β μ λͺ©(Title)μ ν€μλ ν¬ν¨νκΈ°
- μ:
How to Write Good Git Commit Messages
- μμ£Ό κ²μλλ ν€μλ μμ:
- git commit message
- how to write commits
- best practices for git
- conventional commits
β λ³Έλ¬Έ 첫 λ¬Έλ¨μ ν€μλ μ¬μ©
Writing clean and effective Git commit messages is an essential skill for developers. In this guide, weβll cover best practices, common mistakes, and real examples.
β μμ λͺ© ꡬ쑰ν (H2, H3 λ± μ¬μ©)
- μμ:
## Why Git Commit Messages Matter ## Git Commit Message Format (Conventional Commits) ## Common Mistakes to Avoid ## Examples of Good and Bad Commit Messages ## Final Tips for Clean Git Commit History
β μ½ν μΈ λ€μν (μ½λ, ν, μ΄λ―Έμ§ λ±)
- μ½λ μμ , before/after λΉκ΅, ν λ±μ ν¬ν¨νλ©΄ SEO + μ¬μ©μ λ§μ‘±λ μμΉ
β μ¬λ¬κ·Έ(URL) μ΅μ ν
/blog/git-commit-message-guide
β/blog/1234
β
β λ©ν μ€λͺ (meta description) μμ±
- κ²μ κ²°κ³Ό μμ½ λ¬Έμ₯μ νμλ¨
- μ:
A complete guide to writing effective Git commit messages. Learn conventional commit types, examples, and common mistakes developers should avoid.
8. ν°λ―Έλμμ λν μΌν μ»€λ° λ©μμ§ μμ±λ²
β λ°©λ² 1: ν μ€ λ©μμ§ + μ€λͺ μΆκ°
git commit -m "docs: add blog post about writing good Git commit messages" \
-m "Includes best practices, format examples, style comparisons, and SEO tips."
β λ°©λ² 2: κΈ°λ³Έ μλν°μμ μ§μ μμ±
git commit
μ΄ν μ΄λ¦¬λ μλν°μ μλμ κ°μ΄ μ λ ₯:
docs: add blog post about writing good Git commit messages
- Introduced best practices for writing clear commit messages
- Explained the Conventional Commits format with examples
- Compared [bracket] style and colon-based commit prefixes
- Added SEO tips for optimizing blog visibility on Google
β μ΄μ μ»€λ° λ©μμ§ μμ νκΈ° (νΈμ μ )
git commit --amend
κΈ°μ‘΄ λ©μμ§λ₯Ό μμ ν μ μμΌλ©°, νΈμ μ μλ§ μ¬μ©νλ κ²μ΄ μμ ν©λλ€.
10. Vim μλν°μμ μ»€λ° λ©μμ§ μ μ₯/μ’ λ£ λ°©λ²
Gitμμ git commit
μ μ΄λ¦¬λ κΈ°λ³Έ ν
μ€νΈ μλν°λ λ³΄ν΅ Vimμ
λλ€.
μλ μμ
- Oλ₯Ό λλ₯΄λ©΄ λΌμλ£κΈ° νμ±ν
- ESCλ₯Ό λλ₯΄λ©΄ μ μ₯ νΉμ μ’ λ£ν μ μμ.
λμ | λͺ λ Ήμ΄ |
---|---|
μ μ₯ ν μ’ λ£ | :wq + Enter |
μ μ₯ μμ΄ μ’ λ£ | :q! + Enter |
μ μ₯λ§ νκΈ° | :w + Enter |
μ μ₯ ν μ’ λ£ (λΉ λ₯Έ λ°©λ²) | Shift + ZZ |
β κΈ°λ³Έ μλν° λ³κ²½ λ°©λ²
Nanoλ‘ λ³κ²½ (κ°λ¨ν μΈν°νμ΄μ€)
git config --global core.editor "nano"
11. λ§λ¬΄λ¦¬
μ»€λ° λ©μμ§λ λ¨μν λ©λͺ¨κ° μλλΌ μν΅μ λꡬλΌκ³ νλ€. λͺ©μ μ λ°λΌ μ€νμΌμ μ ννλ, μΌκ΄μ±μ μ μ§νκ³ λͺ©μ μ΄ λͺ νν λ©μμ§λ₯Ό μμ±νλ κ²μ΄ κ°μ₯ μ€μν κ±°κ°λ€. ^^
Git λΈλ‘κ·Έλ₯Ό μμ±ν λλ κΈ°μ μ μΈ λ΄μ© + κ²μ μ΅μ ν(SEO) λͺ¨λλ₯Ό κ³ λ €ν΄μ, λ λ§μ κ°λ°μλ€μκ² μ μ©νκ² μ λ¬λ μ μλλ‘ κ΅¬μ±ν΄μΌκ² λ€!