ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

Git

[Git] Git branch strategy ๋ช…๋ช… ๊ทœ์น™ ๋ฐ ์ข…๋ฅ˜

๊ฐœ๋ฐœ๊ฐœ๊ตด๐Ÿธ 2022. 7. 3. 20:46

Git์„ ํ†ตํ•ด ์—ฌ๋Ÿฌ๋ช…์˜ ๊ฐœ๋ฐœ์ž์™€ ํ•จ๊ป˜ ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋‹ค ๋ณด๋ฉด, commit ์ด๋ฆ„ ๊ทœ์น™, branch ๋ช…๋ช… ๊ทœ์น™ ๋“ฑ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ ๋‚ด์—์„œ ์ผ์ •ํ•œ ๊ทœ์น™์„ ์ •ํ•˜๋Š” ๊ฒƒ์€ ์ค‘์š”ํ•œ ๊ณ ๋ ค ๋Œ€์ƒ์ด ๋ฉ๋‹ˆ๋‹ค.

์ผ๋ฐ˜์ ์œผ๋กœ master, develop, feature, release, hotfix 5๊ฐ€์ง€๋กœ ๋ถ„๋ฅ˜๋˜๋Š” ๋ธŒ๋žœ์น˜๋“ค๋ฅผ ์ •๋ฆฌํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

Master(Main) Branch

์ œํ’ˆ์œผ๋กœ ์ถœ์‹œ๋  ์ˆ˜ ์žˆ๋Š” ์ตœ์ƒ์œ„ ๋ธŒ๋žœ์น˜

๋ฐฐํฌ ์ด๋ ฅ์„ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ฆ‰, ๋ฐฐํฌ(Release) ๊ฐ€๋Šฅํ•œ ์ƒํƒœ๋งŒ์„ master branch์— ์ €์žฅํ•˜๊ณ  ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

(๋ณดํ†ต master ๋ธŒ๋žœ์น˜์˜ ๊ฐฑ์‹  ๊ธฐ์ค€์œผ๋กœ ๋ฒ„์ „์„ ์—…๋ฐ์ดํŠธ ํ•ฉ๋‹ˆ๋‹ค.)

 

Develop Branch

๋‹ค์Œ ์ถœ์‹œ ๋ฒ„์ „์„ ๊ฐœ๋ฐœํ•˜๋Š” ๋ธŒ๋žœ์น˜

master์˜ ํ•˜์œ„ ๋ธŒ๋žœ์น˜๋กœ, ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋ธŒ๋žœ์น˜๋“ค์„ ๋ณ‘ํ•ฉํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ฆ‰, ๋ชจ๋“  ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋˜๊ณ  ๋ฒ„๊ทธ๊ฐ€ ์ˆ˜์ •๋˜์–ด ๋ฐฐํฌ ๊ฐ€๋Šฅํ•œ ์•ˆ์ •์ ์ธ ์ƒํƒœ๋ผ๋ฉด develop ๋ธŒ๋žœ์น˜๋ฅผ master์— mergeํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ๋Š” dev์„œ๋ฒ„ ์ „์šฉ ๋ธŒ๋žœ์น˜๋กœ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

 

Feature Branch

๊ฐ๊ฐ์˜ ๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœํ•˜๋Š” ๋ธŒ๋žœ์น˜

feature ๋ธŒ๋žœ์น˜๋Š” ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ ๋ฐ ๋ฒ„๊ทธ ์ˆ˜์ •์ด ํ•„์š”ํ•  ๋•Œ๋งˆ๋‹ค devlop๋ธŒ๋žœ์น˜๋กœ๋ถ€ํ„ฐ ๋ถ„๊ธฐํ•˜์—ฌ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

์ด ์ž‘์—…๋“ค์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ๊ณต์œ ํ•  ํ•„์š”๊ฐ€ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์ž์‹ ์˜ ๋กœ์ปฌ ์ €์žฅ์†Œ์—์„œ ๊ด€๋ฆฌํ•˜๊ฒŒ ๋˜๊ณ , ๊ฐœ๋ฐœ์ด ์™„๋ฃŒ๋˜๋ฉด develop ๋ธŒ๋žœ์น˜๋กœ mergeํ•˜์—ฌ ๋‹ค๋ฅธ ์‚ฌ๋žŒ๋“ค๊ณผ ๊ณต์œ ํ•ฉ๋‹ˆ๋‹ค.

 

  • ‘develop’ ๋ธŒ๋žœ์น˜์—์„œ ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ feature ๋ธŒ๋žœ์น˜๋ฅผ ๋ถ„๊ธฐํ•œ๋‹ค.
  • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ์ž‘์—… ์ˆ˜ํ–‰ํ•œ๋‹ค.
  • ์ž‘์—…์ด ๋๋‚˜๋ฉด ‘develop’ ๋ธŒ๋žœ์น˜๋กœ ๋ณ‘ํ•ฉ(merge)ํ•œ๋‹ค.
  • ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š์€ feature ๋ธŒ๋žœ์น˜๋Š” ์‚ญ์ œํ•œ๋‹ค.
  • ์ƒˆ๋กœ์šด ๊ธฐ๋Šฅ์— ๋Œ€ํ•œ ‘feature’ ๋ธŒ๋žœ์น˜๋ฅผ ์ค‘์•™ ์›๊ฒฉ ์ €์žฅ์†Œ์— ์˜ฌ๋ฆฐ๋‹ค.(push)

์ด๋•Œ feature๋ธŒ๋žœ์น˜์˜ ์ด๋ฆ„์„ ์ •ํ•˜๋Š” ๋ช…๋ช… ๊ทœ์น™์„ ๋”ฐ๋ฅด๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ๋ฅผ ์ง„ํ–‰ํ•˜๋Š” ํŒ€๋ผ๋ฆฌ ์ƒ์˜ํ•˜์—ฌ ์ •ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ •๋‹ต์€ ์—†์ง€๋งŒ, ์˜ˆ์‹œ๋กœ [feature/๊ธฐ๋Šฅ์š”์•ฝ] ํ˜•์‹์„ ์‚ฌ์šฉํ•˜๊ธฐ๋„ ํ•ฉ๋‹ˆ๋‹ค.

 

Release Branch

์ด๋ฒˆ ์ถœ์‹œ ๋ฒ„์ „์„ ์ค€๋น„ํ•˜๋Š” ๋ธŒ๋žœ์น˜

๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ์ „์šฉ ๋ธŒ๋žœ์น˜๋ฅผ ์‚ฌ์šฉํ•จ์œผ๋กœ์จ ํ•œ ํŒ€์ด ํ•ด๋‹น ๋ฐฐํฌ๋ฅผ ์ค€๋น„ํ•˜๋Š” ๋™์•ˆ ๋‹ค๋ฅธ ํŒ€์€ ๋‹ค์Œ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ์„ ๊ณ„์†ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹คfeature branch์—์„œ develop ๋ธŒ๋žœ์น˜๋กœ ์–ด๋Š์ •๋„ merge๋œ ํ›„, ๋ฐฐํฌ๊ฐ€ ์ง„ํ–‰๋˜๊ฑฐ๋‚˜ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ๋Š” ์‹œ์ ์ด ๋˜์—ˆ์„๋•Œ release branch๋ฅผ ์ƒ์„ฑํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ดํ›„ ํ…Œ์ŠคํŠธ๋ฅผ ํ†ตํ•ด ์ตœ์ข…์ ์œผ๋กœ ๋ฒ„๊ทธ ์ˆ˜์ •, ๋ฌธ์„œ ์ถ”๊ฐ€ ๋“ฑ ์‹ค์งˆ์ ์œผ๋กœ release ์ถœ์‹œ ์ง์ „ ๋‹จ๊ณ„ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

 

Hotfix Branch

์ถœ์‹œ ๋ฒ„์ „์—์„œ ๋ฐœ์ƒํ•œ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ • ํ•˜๋Š” ๋ธŒ๋žœ์น˜

๋ฐฐํฌํ•œ ๋ฒ„์ „์—์„œ ๊ธด๊ธ‰ํ•˜๊ฒŒ ์ˆ˜์ •์„ ํ•ด๊ฒŒ ๋ ๋•Œ master์—์„œ ๋ถ„๊ธฐํ•˜์—ฌ ์‚ฌ์šฉ๋˜๋Š” ๋ธŒ๋žœ์น˜์ž…๋‹ˆ๋‹ค. ๋ฒ„๊ทธ๊ฐ€ ์ˆ˜์ •๋œ ์ดํ›„์— master์™€ devleop์— ๊ฐ๊ฐ ๋ณ‘ํ•ฉํ•˜์—ฌ ์ด๋ฅผ ์žฌ๋ฐฐํฌํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋Š” master ๋ธŒ๋žœ์น˜ ํ•˜์œ„์— ์žˆ๋Š” ์ž„์‹œ ๋ธŒ๋žœ์น˜๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค.

 

 

 

 

https://gmlwjd9405.github.io/2018/05/11/types-of-git-branch.html

 

[GitHub] Git ๋ธŒ๋žœ์น˜์˜ ์ข…๋ฅ˜ ๋ฐ ์‚ฌ์šฉ๋ฒ• (5๊ฐ€์ง€) - Heee's Development Blog

Step by step goes a long way.

gmlwjd9405.github.io

https://www.inbogi.com/bok/2020/04/1/

 

[GIT] GIT branch strategy ๋ช…๋ช…๊ทœ์น™ ๋ฐ ์ „๋žต - INBOGI Magazine.

GIT branch ๋ช…๋ช… ๊ทœ์น™ ๋งŒ์•ฝ 1~2๋ช…์—์„œ ํ•˜๋Š” ์†Œ๊ทœ๋ชจ ํ”„๋กœ์ ํŠธ์—์„œ GIT์„ ์‚ฌ์šฉํ•˜๋ฉด ํŠน๋ณ„ํ•˜๊ฒŒ ๊ทœ์น™์ด๋ผ๊ณ  ํ• ๊ฒƒ๋„ ์—†์Šต๋‹ˆ๋‹ค.ํ•˜์ง€๋งŒ ํ”„๋กœ์ ํŠธ ๊ทœ๋ชจ๊ฐ€ ์ปค์ง€๊ณ  ์ธ์›๋„ ๋Š˜์–ด๋‚˜๊ฒŒ๋˜๋ฉด ํ•œ๊ฐ€์ง€ ๋ ˆํŒŒ์ง€ํ† ๋ฆฌ๋‚ด์—

www.inbogi.com

 

'Git' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๋‹ค๋ฅธ ๊ธ€

[Git] Git์ด๋ž€?  (0) 2022.07.03