[GIT] ๊น ํ๋ก์ฐ: git-flow & github-flow & gitlab-flow
์ฐธ๊ณ
https://www.hanbit.co.kr/store/books/look.php?p_code=B8463790401
๋ง๋ค๋ฉด์ ๋ฐฐ์ฐ๋ Git+GitHub ์ ๋ฌธ
Git๊ณผ GitHub๋ฅผ ์ด์ฉํ ๋ฒ์ ๊ด๋ฆฌ ์์คํ ์ ๋ค๋ฃจ๋ ๋ฐฉ๋ฒ์ ๋ฐฐ์ฐ๋ ์ ๋ฌธ์๋ค. 1๋ถ๋ ๋ฒ์ ๊ด๋ฆฌ ์์คํ ๊ณผ Git ๊ณ ์ ์ ๋ช ๋ น์ด ์ค์ฌ์ผ๋ก Git์ ๊ธฐ๋ณธ ๊ฐ๋ ์ ๋ฐฐ์ด๋ค. ๊ทธ๋ฆฌ๊ณ Git ๊ธฐ๋ฐ์ ๋ํ์ ์ธ ์๊ฒฉ ์ ์ฅ
www.hanbit.co.kr
git-flow
https://nvie.com/posts/a-successful-git-branching-model/
A successful Git branching model
In this post I present a Git branching strategy for developing and releasing software as I’ve used it in many of my projects, and which has turned out to be very successful.
nvie.com
๋ชจ๋ธ
๋ธ๋์น๋ฅผ ๋ค์ฏ ๊ฐ์ง ์ญํ ๋ก ๋๋๋ค.
- develop ๋ธ๋์น
- feature ๋ธ๋์น
- release ๋ธ๋์น
- master ๋ธ๋์น
- hotfix ๋ธ๋์น
develop ๋ธ๋์น
ํ๋๋ง ์กด์ฌํ๋ค.
์ฌ๊ธฐ์์ ๋ชจ๋ ๊ฐ๋ฐ์ด ์์๋๋ค.
feature ๋ธ๋์น์ release ๋ธ๋์น, hotfix ๋ธ๋์น๊ฐ ์ด ๋ธ๋์น์ ๋ณํฉ๋๋ค.
์ด ๋ธ๋์น๋ ์ค์ง ๋ณํฉ ์ปค๋ฐ๋ง ์ด๋ค์ง๋ค.
feature ๋ธ๋์น
์ฌ๋ฌ ๊ฐ๊ฐ ์กด์ฌํ๋ค.
feature ๋ธ๋์น๋ develop ๋ธ๋์น๋ฅผ ๊ธฐ๋ฐ์ ๋๊ณ ๋ธ๋์น๋์ด ์๋ก์ด ๊ธฐ๋ฅ ๊ฐ๋ฐ์ด๋ ๋ฒ๊ทธ ์์ ์ ๋ด๋นํ๋ค.
๊ฐ๋ผ์ ธ ๋์ค๋ ๊ฒ๋, ๋ค์ ๋ณํฉํ๋ ๊ฒ๋ ์ค์ง develop ๋ธ๋์น์๋ง ํ๋ค.
๊ฐ๊ฐ์ ๋ธ๋์น๋ ํ๋์ ๊ธฐ๋ฅ(์๋)๋ง์ ๊ฐ์ง๋ค.
release ๋ธ๋์น
develop ๋ธ๋์น์์ ๊ฐ๋ผ์ ธ ๋์์ ๋ฐฐํฌ ์ค๋น๋ฅผ ํ๋ ๋ธ๋์น์ด๋ค.
์ค๋ก์ง ๋ฒ๊ทธ ์์ ๋ง์ ํ๋ค. ๋ฐฐํฌ๋ณธ์ ์์ฑ๋๋ฅผ ๋์ด๋ ๋ธ๋์น์ด๋ค.
์์ ๋ ๋ฒ๊ทธ๋ develop ๋ธ๋์น์ ๋ณํฉ๋๋ค.
master ๋ธ๋์น
์ค์ ๋ฐฐํฌ๋๋ ๋ฒ์ ์ด ์๋ ๋ธ๋์น์ด๋ค. release ๋ธ๋์น๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ธ๋์น๋๋ค. hotfitx ๋ธ๋์น์ ๊ธฐ๋ฐ ๋ธ๋์น๊ฐ ๋๋ค.
hotfix ๋ธ๋์น
master ๋ธ๋์น, ์ฆ ํ์ฌ ๋ฐฐํฌ ์ค์ธ ์ฝ๋์ ๋ฒ๊ทธ๊ฐ ์์ด ๊ธํ ์์ ํ ๋๋ง ์ฌ์ฉํ๋ ๋ธ๋์น์ด๋ค.
์์ ๋ ๋ด์ฉ์ master, develop ๋ธ๋์น์๋ง ๋ฐ์ํ๋ค.
ํน์ง
์ฃผ๊ธฐ์ ์ผ๋ก ์์ ๊ฒฐ๊ณผ๋ฅผ ๋ฐฐํฌํ๋ ํ๋ก์ ํธ์ ์ ํฉํ๋ค. ๋งค์ฐ ๊ฒฌ๊ณ ํ ์ฝ๋๋ฅผ ์์ฐํ๋ฉด์ ๋ฐฐํฌ ๊ฐ๊ฒฉ์ด ์ถฉ๋ถํ ๊ธด ํ๋ก๊ทธ๋จ์ด๋ ์๋ฃจ์ ์ ๋ค๋ฃจ๋ ํ๋ก์ ํธ์ ์ ํฉํ๋ค.
๋น ๋ฅธ ๊ฐ๋ฐ๊ณผ ๋ฐฐํฌ์ ์๋ง์ง๋ ์๋ค.
๊ถ์ฅ
๊ฒ์์ด๋ SI ๊ฐ๋ฐ ํ๊ฒฝ์์ ๊ถ์ฅ
- ์ ์ง๋ณด์๊ฐ ์ฝ์ง ์์ ๊ฒฝ์ฐ
- ์ฌ์ฉ ํ๊ฒฝ์ด ์คํ๋ผ์ธ์ผ ๊ฒฝ์ฐ
- ๋์ค์ ์คํ์ ์ค๋จํ ์ ์๋ ๊ฒฝ์ฐ
- ์ฌ์ฉ์๊ฐ ์ ์ง๋ณด์์ ๊ด์ฌ์ ๊ฐ์ง์ง ์์ ๊ฒฝ์ฐ
github-flow
About branches - GitHub Docs
Use a branch to isolate development work without affecting other branches in the repository. Each repository has one default branch, and can have multiple other branches. You can merge a branch into another branch using a pull request.
docs.github.com
๋ชจ๋ธ
๋ ๊ฐ์ง์ ๋ธ๋์น ์ข ๋ฅ๋ง ์กด์ฌํ๋ค.
- master ๋ธ๋์น
- feature ๋ธ๋์น
master ๋ธ๋์น
์ธ์ ๋ ๋ฐฐํฌํ ์ ์๋ ์ํ๋ก ์ ์ง๋๋ ๋ธ๋์น.
๋ณดํต ํ๋๋ง ์กด์ฌํ๋ค.
์ค์ง ๋ณํฉ ์ปค๋ฐ๋ง ํ ์ ์๋ค.
feature ๋ธ๋์น
์ฌ๋ฌ ๊ฐ๊ฐ ์กด์ฌํ ์ ์๋ค.
master ๋ธ๋์น์์ ๊ฐ๋ผ์ ธ์ ์ ๊ธฐ๋ฅ์ ์ถ๊ฐํ๊ฑฐ๋, ๋ฒ๊ทธ๋ฅผ ์์ ํ๊ฑฐ๋, ๊ทธ ์ธ์ ๋ชจ๋ ์ฝ๋ ์์ ์ ๋ด๋นํ๋ค.
ํ ๋ฒ์ ํ๋์ ์๋๋ง์ ๊ตฌํํ๋ค.
๊ถ์ฅ
์น ์ ํ๋ฆฌ์ด์ผ์ด์ ๋ฑ
- ๊ฐ๋ฒผ์ด ํ๋ก์ ํธ. ๋น ๋ฅธ ๊ธฐ๋ฅ ์ถ๊ฐ์ ์์ ์ด ํ์ํ ๋ถ์ผ.
gitlab-flow
https://about.gitlab.com/topics/version-control/what-is-gitlab-flow/
What is GitLab Flow?
Code reviews ensure developers ship the highest quality code through systematic assessments designed to identify bugs.
about.gitlab.com
github-flow์ ๋ถ์กฑํ ์ ์ธ ์์ ์ฑ๊ณผ ๋ฐฐํฌ ์๊ธฐ ์กฐ์ ๊ฐ๋ฅ์ฑ์ ์ถ๊ฐ ๋ธ๋์น๋ฅผ ๋์ด ๋ณด๊ฐํ๋ ์ ๋ต์ ์ฌ์ฉํ๋ค.
Github-flow with Production
production ๋ธ๋์น๊ฐ ์๋ค. feature ๋ธ๋์น์ ์์ ๊ฒฐ๊ณผ๊ฐ master ๋ธ๋์น๋ก ๋ณํฉ๋๊ณ , ๋ฐฐํฌ ์ค๋น๊ฐ ๋๋ฉด master ๋ธ๋์น์์ production ๋ธ๋์น๋ก ๋ณํฉํ๋ค. ์ค์ง ๋ฐฐํฌ๋ง์ ๋ด๋นํ๋ค.
๊ถ์ฅ
๋ชจ๋ฐ์ผ ์ฑ ๊ฐ๋ฐ
์ฌ์ฉ์์ ์๋๋๋ก ๋ฐฐํฌํ ์ ์๋ ํ๊ฒฝ์ ์ ์ ํจ.
Github-flow with Pre-production and Production
Github-flow with Production ์์ ํ๋ฆ์ pre-production ๋ธ๋์น๋ฅผ ์ถ๊ฐํ ๋ชจ๋ธ์ด๋ค.
pre-production ๋ธ๋์น๋ ํ ์คํธ ๋ธ๋์น์ด๋ค. ๊ฐ๋ฐํ๊ฒฝ์์ ๋ฐ๋ก ๋ฐฐํฌํ์ง ์๊ณ ์ฌ์ฉ ํ๊ฒฝ๊ณผ ๋์ผํ ํ ์คํธ ํ๊ฒฝ์์ ์ฝ๋๋ฅผ ํ ์คํธํ๋ ๊ฒ์ด๋ค.
ํ์ฉ
๋ชจ๋ฐ์ผ ์ฑ ๊ฐ๋ฐ ์ ๊ฐ์ข ํ๋์จ์ด์์ ์ ๋๋ก ์คํ๋๋์ง ํ ์คํธํ ํ์๊ฐ ์์ ๊ฒฝ์ฐ production ๋ธ๋์น๋ก ๊ฒฐ๊ณผ๋ฅผ ๋๊ธฐ๊ธฐ ์ ์ pre-production ๋ธ๋์น์์ ํ ์คํธํ ์ ์๋ค.
์น ๊ฐ๋ฐ์ ๊ฒฝ์ฐ, ๋ก์ปฌ ์ ์ฅ์์์ ๊ธฐ๋ฅ ๊ฐ๋ฐ์ ํ ๋ค์, ํ ์คํธ ์๋ฒ์์์ ์ํํ๋ ๊ฒ์ pre-production ๋ธ๋์น๋ฅผ ๋ง๋๋ ๊ฒ์ผ๋ก ์๊ฐํ ์ ์๋ค.
๊ทธ ์ธ ํ๋ก์ ํธ ํน์ฑ ์ ๋ ๋จ๊ณ์ ๊ฑธ์ณ ํ ์คํธ์ ๋ฐฐํฌ๋ฅผ ์งํํด์ผ ํ ํ์๊ฐ ์๋ค๋ฉด ์ฌ์ฉํ ์ ์๋ ์์ ํ๋ฆ์ด๋ค.