08. git flow - nephilim/js-git-kata GitHub Wiki

2013-03-07

git flow

  • a sample of simple, effective git branch model
  • installation homebrew ๋“ฑ์œผ๋กœ ์„ค์น˜
  • ์ฃผ์š” ๋ธŒ๋žœ์น˜๋“ค
    1. master: production release
    2. development: branch name for "next release" development
    3. features
    4. release
    5. hotfix
    6. support

practice

  1. ์‹ค์Šต dir ์ƒ์„ฑ ๋ฐ ์ดˆ๊ธฐ ์ปค๋ฐ‹
    • mkdir git-flow-test; cd git-flow-test; git init
    • echo "fist" >> product.txt
    • git add .
    • git commit -m "first commit"
  2. git flow init
    • git flow ์‹œ์ž‘
  3. ๋‘๋ฒˆ์งธ ์ปค๋ฐ‹
    • echo "second" >> product.txt
    • git commit -am "second commit"
  4. feature-01 ์ž‘์„ฑ
    • git flow feature start feature-01
    • echo "feature-01" >> product.txt
    • git commit -am "feature-01 added"
  5. feature-01 ๋งˆ๋ฌด๋ฆฌ ์•ˆํ•˜๊ณ  feature-02 ์ž‘์„ฑ
    • git flow feature start feature-02
    • cat product.txt
      • feature๋Š” development ์—์„œ ํŒŒ์ƒ๋จ
    • echo "feature-02:1" >> product.txt
    • git commit -am "feature-02:1 added"
    • echo "feature-02:2" >> product.txt
    • git commit -am "feature-02:2 added"
  6. git flow feature finish feature-01
    • feature branch ์‚ญ์ œ๋์Œ์„ ํ™•์ธ
  7. git flow feature finish feature-02
  8. merge conflict
    • git add .; git commit
  9. git flow feature finish feature-02
  10. release
    • develop ๋ธŒ๋žœ์น˜์—์„œ ํŒŒ์ƒ
    • release ์ž‘์—… ๋ธŒ๋žœ์น˜์ด๋‹ค
    • git flow release start 1.0
    • echo "release 1.0" >> RELEASE
    • git add RELEASE
    • git commit -m "release note added"
    • git flow release finish 1.0
  11. release finish ํ›„
    • ์ถœ๋ ฅ ๋ฉ”์‹œ์ง€์˜ Summary of actions:๋ฅผ ์‚ดํŽด๋ณธ๋‹ค
    • release: git graph
      • ์ถœ๋ฐœ์€ developmment ์—์„œ ๋ถ„๋ฆฌ๋œ branch
      • master ๋ธŒ๋žœ์น˜์™€ ๋จธ์ง€
      • developemnt ๋ธŒ๋žœ์น˜์™€ merge
  12. hotfix ์ฒ˜๋ฆฌํ•˜๊ธฐ
    • git flow feature start feature-03
    • echo "feature-03:1" >> product.txt
    • git add product.txt
    • git commit -m "feature-03:1 added"
    • ์ถœ์‹œ๋œ ํ”„๋กœ๊ทธ๋žจ์—์„œ ๋ฌธ์ œ ๋ฐœ๊ฒฌ!
  13. git flow hotfix start hotfix-01
    • cat product.txt
      • hotfix๋Š” master ๋ธŒ๋žœ์น˜์—์„œ ์ƒ์„ฑ๋จ
    • echo "hotfix-01 patched" >> product.txt
    • git commit -am "hotfix-01 patched"
  14. hotfix finish ํ›„
    • ์ถœ๋ ฅ ๋ฉ”์‹œ์ง€์˜ Summary of actions:๋ฅผ ์‚ดํŽด๋ณธ๋‹ค.
    • ์—ญ์‹œ development ๋ธŒ๋žœ์น˜์— back-merge(master > dev)๋œ๋‹ค
  15. feature-03 ๊ณ„์† ์ž‘์—…ํ•˜๊ธฐ
    • git branch๋กœ ํ˜„์žฌ ๋ธŒ๋žœ์น˜ ํ™•์ธ(development)
    • git checkout feature/feature-03
    • echo "feature-03:2" >> product.txt
    • git commit -am "feature-03:2 added"
  16. hotfix(development)๋ฅผ ํ˜„์žฌ ์ž‘์—…์— ๋ฐ˜์˜
    • git flow feature rebase
      • ๋Š˜ ๊ฐ•์กฐํ–ˆ๋“ฏ์ด, rebase ๋„์ค‘ conflict ์ฒ˜๋ฆฌํ•œ ํ›„์—๋Š” add๋งŒํ•˜๊ณ  git rebase --continue ํ•œ๋‹ค.
    • git graph ๋“ฑ์œผ๋กœ ๋ชจ์–‘ ํ™•์ธ ํ›„ rebase ๊ฒฐ๊ณผ๋ฅผ ๋ถ„์„ํ•ด ๋ณด์ž