Search

[git] git commit template μ„€μ •

νƒ€μž…
개발
νƒœκ·Έ
git
mac
κ°œλ°œν™˜κ²½
μƒνƒœ
Published
생성일
2022/06/23 13:50
μ΅œμ’… νŽΈμ§‘ μΌμ‹œ
2023/02/24 11:35
2 more properties
λ§₯뢁 m1에어 μ—μ„œ m1 14pro 둜 기기변경을 ν•˜λ©΄μ„œ κ°œλ°œν™˜κ²½ μ„ΈνŒ…μ„ μ†μˆ˜ μƒˆλ‘œν•˜κ³  μžˆλ‹€.
λ§ˆμ΄κ·Έλ ˆμ΄μ…˜ κΈ°λŠ₯이 μžˆλŠ”κ±Έ μ•Œμ§€λ§Œ λ­”κ°€ μ‹Ή λ‹€ κ°ˆμ•„μ—Žκ³  μƒˆλ‘­κ²Œ μ‹œμž‘ν•˜κ³  싢은 λŠλ‚Œμ΄ λ“€μ–΄μ„œ μ‚¬μ„œ 고생 쀑이닀..
μƒˆλ‘œμš΄ λ§₯뢁에 기쑴에 μ“°λ˜ git commit template 을 μ μš©ν•˜λ €κ³  ν•œλ‹€.

commit template μ„€μ •

commit template 을 ν”„λ‘œμ νŠΈ λ‹¨μœ„(둜컬)둜 μ„€μ •ν•  수 도 있고, κΈ€λ‘œλ²Œλ‘œ μ„€μ •ν•  μˆ˜λ„ μžˆλŠ”λ° λ‹Ήμž₯은 κΈ€λ‘œλ²Œλ‘œ μ„€μ •ν•˜λ €κ³  ν•œλ‹€.
β€’
vi ~/.git-commit-template
vi μ—λ””ν„°λ‘œ ν™ˆ 디렉토리에 ν•΄λ‹Ή νŒŒμΌμ„ λ§Œλ“€μ–΄μ€€λ‹€.
맨 μ•žμ— . 을 μ°μ–΄μ„œ μˆ¨κΉ€νŒŒμΌλ‘œ μƒμ„±ν•˜λŠ” 것을 μΆ”μ²œν•œλ‹€.
β€’
.git-commit-template
# <[type]>: <subject> ##### Subject 50 characters ################# -> # Body Message ######## Body 72 characters ####################################### -> # Issue Tracker Number or URL (optional) -> # --- COMMIT END --- # Type can be # feat : μƒˆλ‘œμš΄ κΈ°λŠ₯ μΆ”κ°€ # fix : 버그/μ˜€νƒ€(typo)/둜직 λ“± μ½”λ“œλ₯Ό μˆ˜μ •ν•œ 경우 # refactor: μ½”λ“œ λ¦¬νŒ©ν† λ§ # style : μ½”λ“œ ν¬λ§·νŒ…, μ„Έλ―Έμ½œλ‘  λˆ„λ½ μˆ˜μ • λ“± λ‚΄λΆ€ 둜직 변경이 없이 μ½”λ“œλ₯Ό μˆ˜μ •ν•œ 경우 # docs : README λ¬Έμ„œ μˆ˜μ • # test : ν…ŒμŠ€νŠΈ μ½”λ“œ, λ¦¬νŒ©ν† λ§ ν…ŒμŠ€νŠΈ μ½”λ“œ μΆ”κ°€ # chore : λΉŒλ“œ 업무 μˆ˜μ •, νŒ¨ν‚€μ§€ λ§€λ‹ˆμ € μˆ˜μ • # remove : μ½”λ“œ/파일 μ‚­μ œ # dep : νŒ¨ν‚€μ§€ μ„€μΉ˜/μ‚­μ œ λ“± μ˜μ‘΄μ„± κ΄€λ ¨ μˆ˜μ • # etc : 기타 # ------------------ # Remember me ~ # Capitalize the subject line # 제λͺ©μ€„은 λŒ€λ¬Έμžλ‘œ μ‹œμž‘ν•œλ‹€. # Use the imperative mood in the subject line # 제λͺ©μ€„은 λͺ…λ Ήμ–΄λ‘œ μž‘μ„±ν•œλ‹€. # Do not end the subject line with a period # 제λͺ©μ€„은 λ§ˆμΉ¨ν‘œλ‘œ 끝내지 μ•ŠλŠ”λ‹€. # Separate subject from body with a blank line # λ³Έλ¬Έκ³Ό 제λͺ©μ—λŠ” λΉˆμ€„μ„ λ„£μ–΄μ„œ κ΅¬λΆ„ν•œλ‹€. # Use the body to explain what and why vs. how # λ³Έλ¬Έμ—λŠ” "μ–΄λ–»κ²Œ" λ³΄λ‹€λŠ” "μ™œ"와 "무엇을" μ„€λͺ…ν•œλ‹€. # Can use multiple lines with "-" for bullet points in body # 본문에 λͺ©λ‘μ„ λ‚˜νƒ€λ‚Όλ•ŒλŠ” "-"둜 μ‹œμž‘ν•œλ‹€. # ------------------
Plain Text
볡사
β€’
git config --global commit.template ~/.git-commit-template
ν™ˆ κ²½λ‘œμ— μžˆλŠ” 컀밋 ν…œν”Œλ¦Ώμ„ git κΈ€λ‘œλ²Œμ— μ„€μ •ν•œλ‹€.
β€’
git config --global core.editor "code --wait"
λ˜ν•œ 컀밋 λ©”μ‹œμ§€ νŽΈμ§‘μ„ ν•˜λŠ” 에디터λ₯Ό vs code 둜 λ³€κ²½ν•΄μ€€λ‹€.
(vim μ΄λ‚˜ nano λ₯Ό μ“°κ³  싢은 μ‚¬λžŒμ€ ꡳ이 μ•ˆν•΄λ„ λœλ‹€.)
잘 μ μš©λλŠ”μ§€ 확인을 ν•˜κ³  μ‹ΆμœΌλ©΄ git config --list 둜 확인을 해보면 λœλ‹€.
ν”„λ‘œμ νŠΈλ§ˆλ‹€ λ‹€λ₯Έ commit template 을 μ„€μ •ν•˜λ €λ©΄ ν•΄λ‹Ή ν”„λ‘œμ νŠΈμ˜ git config β€”local commit.template [ν…œν”Œλ¦ΏνŒŒμΌκ²½λ‘œ] λͺ…λ Ήμ–΄λ‘œ μ„€μ •ν•΄μ£Όλ©΄ λœλ‹€.
νŒŒμΌμ„ μˆ˜μ •ν•˜κ³  git add, git commit λͺ…령을 터미널에 μž…λ ₯해보면 μ•„λž˜μ²˜λŸΌ vs code νŽΈμ§‘κΈ° 상에 commit ν…œν”Œλ¦Ώμ΄ 잘 λœΈμ„ 확인할 수 μžˆλ‹€.
μ›ν•˜λŠ” μ»€λ°‹λ©”μ‹œμ§€λ₯Ό μž…λ ₯ν•˜κ³  λ¬Έμ„œ 창을 λ‹«μœΌλ©΄ commit 이 μ™„λ£Œλœλ‹€.