All Articles

Branching Strategy with Git

Central repo (two main branches)

  • origin/master : production-ready state
  • origin/dev : reflect the latest delivered development changes for the next release

    merged back into master and tagged with a release number at a stable point (integration branch)

    1. initialize(create) master

    1

    git init 
    1. create and checkout dev branch from master

    2

    git checkout -b dev master
    1. merge branch dev into master

    3

    git checkout master
    git merge --no-ff dev

    4

Feature branch

May branch off from: develop Must merge back into: develop

  • non fast-forward(left) : merge commit 이 생성됨 (—no-ff 옵션 필수)
git merge --no-ff feature
  • fast-forward(right) : 다른 커밋한 내용과 구분하기 힘듬

5

local branch 로 유지 후 삭제 또는 server 로 push 후 삭제

$ git checkout dev              ## Switched to branch 'develop'
$ git merge --no-ff feature     ## Updating ea1b82a..05e9557
																## (Summary of changes)
$ git branch -d feature         ## Deleted branch myfeature (was 05e9557).
$ git push origin dev
  1. create feature branch from dev

6

7

  1. merge branch feature/web1 into dev
git checkout dev
git merge --no-ff feature/web1

8

  1. create feature 2 branch from dev
  2. merge branch feature/web2 into dev

9

Untitled

Reference

#dogfeet - A successful git branching model

A successful Git branching model » nvie.com

Git - Book (git-scm.com)