๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๋นˆ ๊ตฌ๋ฉ ์ฑ„์šฐ๊ธฐ

[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

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches

 

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 ๋ธŒ๋žœ์น˜๋ฅผ ๋งŒ๋“œ๋Š” ๊ฒƒ์œผ๋กœ ์ƒ๊ฐํ•  ์ˆ˜ ์žˆ๋‹ค. 

๊ทธ ์™ธ ํ”„๋กœ์ ํŠธ ํŠน์„ฑ ์ƒ ๋‘ ๋‹จ๊ณ„์— ๊ฑธ์ณ ํ…Œ์ŠคํŠธ์™€ ๋ฐฐํฌ๋ฅผ ์ง„ํ–‰ํ•ด์•ผ ํ•  ํ•„์š”๊ฐ€ ์žˆ๋‹ค๋ฉด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ž‘์—… ํ๋ฆ„์ด๋‹ค.