Git Rebase ์ค Husky ํ ๋ฌธ์ ํด๊ฒฐํ๊ธฐ
git rebase
๋ฅผ ์งํํ๋ค ๋ณด๋ฉด prepare-commit-msg
ํ
์ด ์ปค๋ฐ ๋ฉ์์ง ํ์์ ๊ฒ์ฌํ๋ ๊ณผ์ ์์ ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ ์๋ค.
์ปค๋ฐ ๋ฉ์์ง๊ฐ ์ ํด์ง ๊ท์น์ ๋ง์ง ์์ผ๋ฉด rebase๊ฐ ์ค๋จ๋๊ณ , ์๋์ ๊ฐ์ ๋ฉ์์ง๊ฐ ์ถ๋ ฅ๋ ์ ์๋ค.
COMMIT REJECTED: { [api|web|infra] feat|fix|refactor|chore|test|docs|style|rename: commit ์ ๋ชฉ } ์ ์๋ ํ์์ ๋ง๊ฒ ์์ฑํด์ฃผ์ธ์
husky - prepare-commit-msg hook exited with code 1 (error)
error: could not commit staged changes.
prepare-commit-msg๋ฅผ ๋ ์์ ํ์ฌ ์๋ก์ด ์ปค๋ฐ์ ์์ฑํ๊ธฐ ๋ณด๋ค๋,
rebase ์ค์ prepare-commit-msg
ํ
์ ์์๋ก ๋นํ์ฑํํ๋ ๋ฐฉ๋ฒ์ด ํจ๊ณผ์ ์ด๋ค.
1. ์์๋ก Husky ํ ๋นํ์ฑํ
HUSKY
ํ๊ฒฝ ๋ณ์๋ฅผ ์ค์ ํ์ฌ ํ
์ ๋นํ์ฑํํ ์ํ๋ก rebase๋ฅผ ์งํํ ์ ์๋ค.
HUSKY=0 git rebase --continue
์ด ๋ช
๋ น์ด๋ prepare-commit-msg
ํ
์ ๊ฑด๋๋ฐ๊ณ rebase๋ฅผ ์๋ฃํ ์ ์๊ฒ ํด์ค๋ค.
2. rebase ์๋ฃ ํ ํ ํ์ฑํ
์ ๋ฐฉ๋ฒ์ผ๋ก rebase๋ฅผ ์๋ฃํ๋ฉด, ํ ์ ๋ค์ ์๋์ผ๋ก ํ์ฑํ๋๋ค. ์ดํ ์ปค๋ฐ ์์ ์์๋ ๋ค์ ํ ์ด ์ ์์ ์ผ๋ก ๋์ํ๊ฒ ๋๋ค.