๐ ํ์ต ๋ชฉํ
- Git flow๊ฐ ์ด๋ค ๋ฐฉ์์ผ๋ก ์ด์ ๋๋์ง ์๊ณ , main, develop, feature, release, hotfix ๋ธ๋์น๋ฅผ ๊ฐ๊ฐ ๊ตฌ๋ถํ์ฌ ์ค๋ช ํ ์ ์๋ค.
- branch๋ฅผ ๋ณํฉํ๋ ๋ ๊ฐ์ง ๋ฐฉ์์ธ rebase์ merge์ ์ฐจ์ด์ ์ ๋ํด ์ค๋ช ํ ์ ์๋ค.
- rebase ๋ช ๋ น์ด๋ฅผ ์ฌ์ฉํ์ฌ ๋ถํ์ํ ์ปค๋ฐ์ ํ๋๋ก squash ํ ์ ์๋ค.
Main branch: ์์คํ
๋ฐฐํฌ๋ฅผ ์ํ ๋ธ๋์น
Develop branch: ๋ฐฐํฌ์ ์ ๊ฐ๋ฐ์ด ์๋ฃ๋ ํ, ํ
์คํธ ํด๋ณด๋ ๋ธ๋์น
Main์์ ๋ธ๋์น๋ฅผ develop ๋ธ๋์น๋ฅผ ๋ง๋ค๊ณ , ๊ทธ ์์์ ๋ ๊ฐ๊ฐ์ feature ๋ธ๋์น๋ฅผ ์์ฑ.
two commands that integrate changes but act in a very different way.
git merge์ ๋ฌธ์ ์
git rebase
git rebase์ ๋ฌธ์ ์
์ปค๋ฐ๋ค์ ํ๋๋ก ํฉ์ณ์ฃผ๋ ๊ธฐ๋ฅ์ด๋ค. rebase๊ณผ์ ์์ squash๋ฅผ ํ ์ ์๋ค.
squash ์งํ
๊ฐ์ฅ ์ค๋๋ commit์ pickํ ๋ค
๋ค๋ฅธ๊ฒ๋ค์ ์ค๋๋ commit ๊ธฐ์ค์ผ๋ก squashํ๋ค
๋ค๋ฅธ ์ปค๋ฐ์ ์์
๋ด์ฉ์ด ์์ด์ง๋๊ฒ ์๋
Esc -> :wq!๋ก ํ์ถ
pushํ ๋, force push๋ก ์งํํ๋ค.
'git push origin ๋ธ๋์น์ด๋ฆ -f'
์๋ ์๋ ์ปค๋ฐ๊ณผ ์ต์ ์ปค๋ฐ์ ํฉ์ณ ์ปค๋ฐ์ด ์ถ๊ฐ๋๋๊ฒ์ด ์๋ ๋์ฒด๋๊ธฐ ๋๋ฌธ์ ๊ฐ์ ๋ก pushํ์ง ์์ผ๋ฉด, git์์ human error์ ๊ฐ๋ฅ์ฑ์ ์๊ฐํ์ฌ, ์ฐจ๋จ๊ธฐ๋ฅ์ ํ์ฑํ ์ํด.