branch strategy - connect-foundation/2019-07 GitHub Wiki

branch strategy

github flow๋ฅผ base๋กœ ํ”„๋กœ์ ํŠธ์— ์ ํ•ฉํ•˜๊ฒŒ ์ˆ˜์ •ํ•จ.

๋ชจ๋“  ๊ทœ์น™์€ ์„œ๋กœ๋ฅผ ๋ฐฐ๋ คํ•˜๊ณ  ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•ด ์กด์žฌํ•œ๋‹ค!

๊ธฐ๋ณธ

์ฐธ๊ณ 

tools

gitKraken & Sourcetree

๊ฐ branch ๋ฐ commit์˜ ์ƒํƒœ๋ฅผ ์‹œ๊ฐํ™” ํ•˜๊ธฐ ์œ„ํ•ด ํŒ€์›์€ "GitKraken", ํ˜น์€ "Sourcetree"๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

git graph

vsCode์šฉ ํ™•์žฅ ํ”„๋กœ๊ทธ๋žจ์ธ "git graph"๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ๋„ ์ง€ํ–ฅํ•œ๋‹ค.

our git-flow

remote ์ €์žฅ์†Œ์˜ branch ๊ตฌ์„ฑ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • master
  • develop

local ์ €์žฅ์†Œ์˜ branch ๊ตฌ์„ฑ์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

  • develop
  • feature/XXX

remote - master

LTS ๋ฒ„์ „์„ ์ €์žฅํ•˜๋Š” branch.

cloud์— ๋ฐฐํฌํ•˜๋Š” ์ฝ”๋“œ์ด๋‹ค.

master branch ๊ฐ€ ๊ฐฑ์‹ ๋œ ๊ฒฝ์šฐ ๋ฐฐํฌ cloud ์„œ๋ฒ„๋„ ๊ฐฑ์‹ ํ•œ๋‹ค.

๋งค์ฃผ ๋ชฉ์š”์ผ develop branch์—์„œ merge ํ•œ๋‹ค.

master branch์˜ ๋‚ด์šฉ์ด ์—…๋ฐ์ดํŠธ ๋˜๋Š” ๊ฒฝ์šฐ git tag๋ฅผ ์ด์šฉํ•œ๋‹ค.

remote - develop

ํ•˜๋ฃจ ํ˜น์€ ์ดํ‹€์— ํ•œ๋ฒˆ ๊ฐ์ž local์˜ develop branch๋“ค์—์„œ ๋‚ ์•„์˜จ PR์„ mergeํ•ด ๊ฐฑ์‹ ํ•œ๋‹ค.

PR๋ผ๋ฆฌ ์ถฉ๋Œ์ด ์žฆ์„ ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ฝ”๋“œ๋ฆฌ๋ทฐ์‹œ ์ž์‹ ์˜ ์ฝ”๋“œ์™€ conflict ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธฐ์ง€ ์•Š๋Š”์ง€ ๊ผผ๊ผผํžˆ ๊ฒ€ํ† ํ•œ๋‹ค.

local - develop

remote์˜ develop branch๊ฐ€ merge๋˜์–ด ๊ฐฑ์‹ ๋œ ๊ฒฝ์šฐ pull๋กœ ์ตœ์‹  ์ƒํƒœ๋กœ ์—…๋ฐ์ดํŠธ ํ•œ๋‹ค.

feature branch์™€ ์ถฉ๋Œ์ด ์žฆ์„ ์ˆ˜ ์žˆ๋‹ค.

local - feature

๊ฐ์ž ๊ฐœ๋ฐœ์ค‘์ธ ๊ธฐ๋Šฅ์„ ๋‚˜ํƒ€๋‚ด๋Š” branch์ด๋‹ค.

๋ชจ๋“  feature branch๋Š” ์ตœ์‹  ์ƒํƒœ์˜ develop branch์—์„œ ํŒŒ์ƒ๋˜์–ด์•ผ ํ•œ๋‹ค.

branch์˜ ์ด๋ฆ„์€ "feature/๊ธฐ๋Šฅ๋ช…"์œผ๋กœ ๊ตฌ์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.

our git-flow ์‹œ๋‚˜๋ฆฌ์˜ค

ํ”„๋กœ์ ํŠธ ์‹œ์ž‘

ํ”„๋กœ์ ํŠธ ์ดˆ๊ธฐ ๊ตฌ์„ฑ์ด ์™„๋ฃŒ๋œ remote-master branch์—์„œ remote-develop branch๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

๊ฐ ํŒ€์›์€ remote ์ €์žฅ์†Œ์—์„œ, develop branch๋งŒ --single-branch ์˜ต์…˜์œผ๋กœ cloneํ•œ๋‹ค.

์ผ์ผ ์ž‘์—… ๊ฐœ๋ฐœ

๊ฐ์ž์˜ local-develop branch์—์„œ ๊ฐœ๋ฐœํ•  feature branch๋ฅผ ์ƒ์„ฑํ•œ๋‹ค.

feature branch์—์„œ ์ž‘์—… ํ›„, ์™„๋ฃŒ๋˜์—ˆ์„ ์‹œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์ˆœ์„œ๋ฅผ ๋”ฐ๋ฅธ๋‹ค.

  1. ์ž์‹  local์˜ develop-branch๋ฅผ pullํ•ด ์ตœ์‹ ์œผ๋กœ ์œ ์ง€ํ•œ๋‹ค.
  2. local-develop์™€ local-feature์„ mergeํ•œ๋‹ค.
  3. local-develop์—์„œ remote-develop์œผ๋กœ PR์„ ๋ณด๋‚ธ๋‹ค. local-feature์—์„œ ๋”ฐ๋กœ ์„ธ๋ถ€์ ์ธ branch๋ฅผ ์ƒ์„ฑํ•ด ์ž‘์—…ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋‹ค๋งŒ local-develop์— mergeํ•˜๊ธฐ ์ „ branch๋ฅผ ์ „๋ถ€ ์ •๋ฆฌํ•˜๋„๋ก ํ•œ๋‹ค.

PR merge

remote-develop์˜ merge ๊ถŒํ•œ์€ ๊ทธ ์ฃผ์˜ ํŒ€์žฅ์ด ๊ฐ–๋Š”๋‹ค.

์ฝ”๋“œ๋ฆฌ๋ทฐ๋ฅผ ์ง„ํ–‰ํ•œ PR๋งŒ mergeํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.

๊ฐ ํŒ€์›์€ conflict๊ฐ€ ๋ฐœ์ƒํ•˜์ง€ ์•Š๋„๋ก ์ฝ”๋“œ ๋ฆฌ๋ทฐ๋ฅผ ์ง„ํ–‰ํ•œ๋‹ค.

์ถฉ๋Œ์ด ๋‚ฌ์„ ๊ฒฝ์šฐ, ์ถฉ๋Œ์ด ๋‚œ ์ธ์›๋ผ๋ฆฌ ๋ชจ์—ฌ ์ถฉ๋Œ ๋ถ€๋ถ„์„ ๊ฐœ์„ ํ•œ๋‹ค.

๊ณตํ†ต์ ์œผ๋กœ ์‚ฌ์šฉ ๋ฐ ์ˆ˜์ •ํ•˜๋Š” ํŒŒ์ผ์˜ ๊ฒฝ์šฐ๋Š” PR์„ ์ฃผ๊ธฐ์ ์œผ๋กœ ๋‚ ๋ฆฌ๊ณ , mergeํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฐ ๊ธฐ๋Šฅ์„ ๊ฐœ๋ฐœํ•˜๋ฉฐ ์ถฉ๋Œ์ด ๋‚  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์ฝ”๋“œ์˜ ๋ชจ๋“ˆํ™”๋ฅผ ํ†ตํ•ด ์ถฉ๋Œ์„ ์˜ˆ๋ฐฉํ•˜๋Š” ์ „๋žต์„ ์‚ฌ์šฉํ•œ๋‹ค.

branch ๊ตฌ์„ฑ๋„

์ „์ฒด ๊ตฌ์กฐ

๊ฐœ์ธ๋ณ„ ๊ตฌ์กฐ