git-flow
git-flow๋ Vincent Driessen์ branching model์ ์ ์ฉํ์ฌ ๊ณ ์์ค์ผ๋ก ์ ์ฅ์๋ฅผ ๊ด๋ฆฌํ ์ ์๋๋ก ํด์ฃผ๋ ํ์ฅ๊ธฐ๋ฅ์ด๋ค. branching model์ feature
- develop
- release
- hofixes
- master
๋จ๊ณ๋ก branch๋ฅผ ๋๋ ์ ์ฝ๋๋ฅผ ๊ด๋ฆฌํ๋ ์ ๋ต์ด๋ฉฐ, ์ฌ์ฉ์๊ฐ ์ฝ๊ฒ ์ ๊ทผํ๊ณ ์ฌ์ฉํ ์ ์๋๋ก ํ์ฅ ๊ธฐ๋ฅ(๋ช
๋ น์ด)์ ์ ๊ณตํ๋ ๊ฒ์ด๋ค.
Git-flow์๋ 5๊ฐ์ง ์ข ๋ฅ์ ๋ธ๋์น๊ฐ ์กด์ฌํ๋ค. ํญ์ ์ ์ง๋๋ ์ฃผ์ ๋ธ๋์น๋ค(master, develop)๊ณผ ์ผ์ ๊ธฐ๊ฐ ๋์๋ง ์ ์ง๋๋ ๋ณด์กฐ ๋ธ๋์น๋ค(feature, release, hotfix)์ด ์๋ค.

master : ์ ํ์ผ๋ก ์ถ์๋ ์ ์๋ ๋ธ๋์น
develop : ๋ค์ ์ถ์ ๋ฒ์ ์ ๊ฐ๋ฐํ๋ ๋ธ๋์น
feature : ๊ธฐ๋ฅ์ ๊ฐ๋ฐํ๋ ๋ธ๋์น
release : ์ด๋ฒ ์ถ์ ๋ฒ์ ์ ์ค๋นํ๋ ๋ธ๋์น
hotfix : ์ถ์ ๋ฒ์ ์์ ๋ฐ์ํ ๋ฒ๊ทธ๋ฅผ ์์ ํ๋ ๋ธ๋์น
git-flow ์์ํ๊ธฐ
$ git flow init
์ฃผ์ ๋ธ๋์น(main branches)

master branch
๊น์์์ ๊ธฐ๋ณธ ๋ธ๋์น์ด๋ค. ๋ฐฐํฌ๋์๊ฑฐ๋ ๋ฐฐํฌ ์ค๋น๋ ์ฝ๋๋ origin/master
์ ๋๊ณ ๊ด๋ฆฌํ๋ค. master
๋ธ๋์น์ mergeํ๋ค๋ ๊ฒ์ ์๋ก์ด ๋ฒ์ ์ ๋ฐฐํฌํ๋ค๋ ๊ฒ์ ์๋ฏธํ๋ค.
develop branch
๋ค์์ ๋ฐฐํฌํ๊ธฐ ์ํด ๊ฐ๋ฐํ๋ ์ฝ๋๋ origin/develop
์์ ๊ด๋ฆฌํ๋ค. ํ๋ก์ ํธ๋ฅผ ์งํํ๋ ๊ฐ๋ฐ์๋ค์ด ํจ๊ป ๋ณด๋ฉฐ ์
๋ฌด๋ฅผ ์งํํ๋ ๋ธ๋์น์ด๋ค. develop
๋ธ๋์น์ ์ฝ๋๊ฐ ์์ ํ๋๊ณ , ๋ฐฐํฌํ ์ค๋น๊ฐ ๋๋ฉด master
์ mergeํ๊ณ , ๋ฐฐํฌ๋ฒ์ ์ผ๋ก ํ๊ทธ๋ฅผ ๋จ๋ค.
develop
๋ธ๋์น๋ master
๋ก๋ถํฐ ์์๋ ๋ธ๋์น์ด๋ค.
๋ณด์กฐ ๋ธ๋์น(Supporting branches)
feature branch

์์ ๋ธ๋์น :
develop
๋ณํฉ(merge) ๋์ ๋ธ๋์น :
develop
Branch naming ๊ท์น
master
,develop
,release-*
,hotfix-*
์ ์ ์ธํ ์ด๋ ํ ๊ฒ์ฐ๋ฆฌ๋ ์ผ๊ฐ๋ฒํธ-์ผ๊ฐ์๋ํ๊ฐ๋ตํ๋ด์ฉ์ผ๋ก ์์ฑํ๊ณ ์๋ค.
feature
๋ธ๋์น๋ ๋ฐฐํฌํ๋ ค๊ณ ํ๋ ๊ธฐ๋ฅ์ ๊ฐ๋ฐํ๋ ๋ธ๋์น์ด๋ค. ๊ธฐ๋ฅ์ ๊ฐ๋ฐํ๊ธฐ ์์ํ ๋๋ ์ธ์ ๋ฐฐํฌํ ์ ์์์ง ์ ์ ์๋ค. feature
๋ธ๋์น๋ ๊ทธ ๊ธฐ๋ฅ์ ๋ค ์์ฑํ ๋๊น์ง ์ ์งํ๊ณ ์๋ค๊ฐ ๋ค ์์ฑ๋๋ฉด.develop
๋ธ๋์น๋ก mergeํ๋ค.
feature branch ์์ฑ
$ git flow feature start <branch name>
feature/branchname
์ผ๋ก ์์ฑ๋๊ณ , ์๋์ผ๋ก ํด๋น branch๋ก checkout๋๋ค.
$ git checkout -b <branch name> develop
feature branch merge
$ git flow feature finish <branch name>
์์ฑํ feature
branch๋ฅผ develop
๋ธ๋์น์ mergeํ๋ค. ๊ทธ๋ฆฌ๊ณ feature ๋ธ๋์น๋ฅผ ์ญ์ ํ๊ณ , develop ๋ธ๋์น๋ก ์ ํํ๋ค.
$ git checkout develop
$ git merge --no-ff myfeature
$ git branch -d myfeature
feature branch publish
$ git flow feature publish <branch name>
ํด๋น branch๋ฅผ ๋ค๋ฅธ ๊ฐ๋ฐ์์ ๊ณต๋์ผ๋ก ๊ฐ๋ฐํ๊ณ ์ถ๋ค๋ฉด ์๊ฒฉ ์๋ฒ์ ์ฌ๋ ค์ฃผ๋ฉด๋๋ค.
feature branch pull
$ git flow feature pull origin <branch name>
๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ ์ฌ์ฉํ๋ ๋ธ๋์น๋ฅผ ๊ฐ์ ธ์ค๋ ๋ช ๋ น์ด์ด๋ค.
release branch

์์ ๋ธ๋์น :
develop
๋ณํฉ(merge) ๋์ ๋ธ๋์น :
develop
,master
Branch naming ๊ท์น
release-*
release
branch๋ ์ค์ ๋ฐฐํฌํ ์ํ๊ฐ ๋ ๊ฒฝ์ฐ์ ์์ฑํ๋ ๋ธ๋์น์ด๋ค. ๋ณดํต release ์ ๊ฒ์ ์ํด ๊ฐ๋จํ ๋ฒ๊ทธ๋ฅผ ์์ ํ๋ ์์
๋ฑ์ ๋ชฉ์ ์ผ๋ก ์ฌ์ฉ๋๋ค.
์ฐ๋ฆฌ๋ ์ฌ์ฉ์ํ๊ณ ์๋ค.
release branch create
$ git flow release start <version>
$ git flow release start v.0.0.1
release๋ฅผ ์์ํ๋ฉด release/<version>
์ ์ด๋ฆ์ ๊ฐ๋ ์๋ก์ด branch๋ฅผ ํ๋ ์์ฑํ์ฌ checkoutํ๋ค.
$ git checkout -b release-1.2 develop
Switched to a new branch "release-1.2"
$ ./bump-version.sh 1.2
Files modified successfully, version bumped to 1.2.
$ git commit -a -m "Bumped version number to 1.2"
[release-1.2 74d9424] Bumped version number to 1.2
1 files changed, 1 insertions(+), 1 deletions(-)
release branch publish
release ๋ธ๋์น๋ฅผ ์์ฑํ ํ์๋ commit์ ํ์ฉํ๊ธฐ ์ํด publish ํด์ฃผ๋ ๊ฒ์ด ํ๋ช ํ๋ค.
$ git flow release publish <version>
release branch track
$ git flow release track <version>
๋ค์๊ณผ ๊ฐ์ด ์๊ฒฉ release
๋ธ๋์น์ ๋ณ๊ฒฝ์ ์ถ์ ํ ์ ์๋ค.
release branch finish
release๋ฅผ ์ํ ์ ๊ฒ์ด ๋๋ ๊ฒฝ์ฐ์ release๋ฅผ ์ข ๋ฃํ๋ค.
$ git flow release finish <version>
$ git push --tags
release finish
๋ช
๋ น์ด๊ฐ ์คํ๋๋ฉด 1. release ๋ธ๋์น ์ฝ๋๋ฅผ master์ merge 2. release ์ด๋ฆ์ผ๋ก ํ๊ทธ ๋ฑ๋ก 3. release๋ฅผ develop branch์ ์ฌ๋ณํฉ(back-merge) 4. release ๋ธ๋์น์ญ์ ์์ผ๋ก ์งํ๋๋ค.
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff release-1.2
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff release-1.2
Merge made by recursive.
(Summary of changes)
$ git branch -d release-1.2
hotfix branch

์์ ๋ธ๋์น :
master
๋ณํฉ(merge) ๋์ ๋ธ๋์น :
develop
,master
Branch naming ๊ท์น
hotix-*
๋ฐฐํฌ๋ฅผ ์ค๋นํ๊ณ , ์ด๋ฏธ ๋ฐฐํฌํ ์ ํ์ด๋ ์๋น์ค์ ๋ฒ๊ทธ๋ฅผ ์ฆ๊ฐ ๋์(hotfix)ํด์ผํ ๋ ์ฌ์ฉํ๋ ๋ธ๋์น์ด๋ค. ์ฆ, ๊ธด๊ธ ์์ ๋ธ๋์น์ด๋ค.
hotfix branch start
$ git flow hotfix start VERSION [BASENAME]
์ฌ๊ธฐ์ version์ hotfix
์ด๋ฆ์ ์ง์ ํ๋ค. ์ ํ์ ์ผ๋ก basename์ผ๋ก ์์์ ์ ์ง์ ํ ์ ์๋ค.
$ git checkout -b hotfix-1.2.1 master
Switched to a new branch "hotfix-1.2.1"
$ ./bump-version.sh 1.2.1
Files modified successfully, version bumped to 1.2.1.
$ git commit -a -m "Bumped version number to 1.2.1"
[hotfix-1.2.1 41e61bb] Bumped version number to 1.2.1
1 files changed, 1 insertions(+), 1 deletions(-)
hotfix branch finish
$ git flow hotfix fisnish VERSION
ํซํฝ์ค๋ฅผ ์ข
๋ฃํ๋ฉด ํซํฝ์ค๋ develop
๋ฐ master
๋ธ๋์น๋ก merge๋๋ค. master ๋ธ๋์น๋ก์ merge ๋ถ๋ถ์ ํซํฝ์ค ๋ฒ์ ์ผ๋ก tag๋๋ค.
$ git checkout master
Switched to branch 'master'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git tag -a 1.2.1
$ git checkout develop
Switched to branch 'develop'
$ git merge --no-ff hotfix-1.2.1
Merge made by recursive.
(Summary of changes)
$ git branch -d hotfix-1.2.1
Deleted branch hotfix-1.2.1 (was abbe5d6).
git-flow vs gif-flow-avh
gif-flow
๋ hotfix๋ฅผ dev์ master์ ๊ฐ๊ฐ merge๋ฅผ ํ๋ค. ์ฆ, ๊ฐ์ง๊ฐ hot fix ํ๋์์ dev์ master branch๋ก ๋๋์ด์ง๋ ํํ์ด๋ค.
git-flow-avh
๋ hotfix๊ฐ dev branch๋ก merge๋๊ณ , hotfix๊ฐ merge๋ dev branch๋ฅผ master branch์ mergeํ๋ ํํ์ด๋ค. (hotfix
> dev
> master
์์, git-flow-avh
๊ฐ ์ต์ ๋ฒ์ ์ด๋ค.)
$ brew install git-flow-avh
์ฐธ๊ณ ์๋ฃ
Last updated
Was this helpful?