๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ’ป DEV/GitHub

[Github - git flow]Git Flow ์ „๋žต - squash merge

by Rising Oneโ˜… 2024. 8. 6.
728x90
๋ฐ˜์‘ํ˜•
SMALL

Github ๋กœ๊ณ 

 

Git Flow Strategy ๋ฅผ ํ†ตํ•ด์„œ ํ”„๋กœ์ ํŠธ ํ˜‘์—… · ํ˜•์ƒ๊ด€๋ฆฌ๋ฅผ ์ด์–ด๊ฐ€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

์ƒ์„ฑํ•œ feature ๋ธŒ๋žœ์น˜๋ฅผ develop ๋ธŒ๋žœ์น˜์— ๋ณ‘ํ•ฉ(merge)ํ•  ๋•Œ์— ํ๋ฆ„๊ณผ ๋ฐฉ๋ฒ•์„ ๋ฉ”๋ชจํ•˜๊ณ ์ž ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

ํŠนํžˆ ์ปค๋ฐ‹-ํ‘ธ์‹œ ์ด๋ ฅ์„ ๊ฐ„๊ฒฐ·์ •๋ˆ๋˜๊ฒŒ ํ•ด์ฃผ๋Š” squash merge๋ฅผ ์ค‘์ ์ ์œผ๋กœ ๋‹ค๋ฃจ๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค.

 

์š”์•ฝ

  1. ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ (Owner or Admin)

 

  2. ๋กœ์ปฌ์—์„œ Clone ํ›„ git flow init

 

  3. develop ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

 

  4. feature ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

 

  5. push ๋ฐ PR (Pull Request) 

  6. PR close & squash merge 


์ƒ์„ธ

   1. ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ (Owner or Admin)

 

 


   2. ๋กœ์ปฌ์—์„œ Clone ํ›„ git flow init

# git flow ์‹œ์ž‘
git flow init

git flow init

 

 

  3. develop ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

โ—ผ๏ธŽ 2๋ฒˆ์˜ ๊ณผ์ •์—์„œ ๋ณ„ ๋‹ค๋ฅธ ์ž‘์„ฑ·์ˆ˜์ •์—†์ด enter๋ฅผ ์—ฐ๋‹ฌ์•„ ์ž…๋ ฅ ํ›„์—๋Š” develop ๋ธŒ๋žœ์น˜๊ฐ€ ์ƒ์„ฑ์ด ๋œ๋‹ค.

โ—ผ๏ธŽ ์ƒ์„ฑ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ, develop ๋ธŒ๋žœ์น˜๋กœ ์ฒดํฌ์•„์›ƒ(checkout)๋„ ๋œ๋‹ค.

 

โ—ผ๏ธŽ ์›๊ฒฉ ์ €์žฅ์†Œ๋กœ develop ๋ธŒ๋žœ์น˜๋ฅผ push

- (ssh ๋ฐฉ์‹์œผ๋กœ clone์„ ๋ฐ›์•˜๊ธฐ ๋•Œ๋ฌธ์— rsa key password๋ฅผ ๋ฌป๋Š”๋‹ค.)

 

 

   4. feature ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

feature ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

 

# ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•  feature ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑ
# ๋ธŒ๋žœ์น˜๋ช…์€ "feature/๋ธŒ๋žœ์น˜๋ช…"์œผ๋กœ ์ƒ์„ฑ์ด ๋˜๋ฉฐ ์•ž์— feature/ ๊ฐ€ ๋ถ™๋Š”๋‹ค

git flow feature start ๋ธŒ๋žœ์น˜๋ช…

 

โ—ผ๏ธŽ "feature/๋ธŒ๋žœ์น˜๋ช…" ์œผ๋กœ ๋ธŒ๋žœ์น˜๊ฐ€ ์ƒˆ๋กœ ์ƒ์„ฑ๋˜๊ณ , ์ž๋™์œผ๋กœ ์ฒดํฌ์•„์›ƒ(checkout) ๋œ๋‹ค.

 

   5. push ๋ฐ PR (Pull Request) 

 

โ—ผ๏ธŽ ํ•ด๋‹น ์ฝ”๋“œ ์ž‘์—…์ด ๋งˆ์ณ์ง€๋ฉด, ์ปค๋ฐ‹&ํ‘ธ์‹œ๋ฅผ ํ•ด์„œ ์›๊ฒฉ ์ €์žฅ์†Œ์™€ ํ˜•์ƒ์„ ์ผ์น˜์‹œ์ผœ์ค˜์•ผํ•œ๋‹ค.

โ—ผ๏ธŽ ํ‘ธ์‹œ ์ดํ›„์—๋Š”, Github(Web)์œผ๋กœ ๊ฐ€์„œ PR(Pull Request)๋ฅผ ์ž‘์„ฑํ•ด์ค€๋‹ค.

 

  6. PR close & squash merge 

 

โ—ผ๏ธŽ squash and merge ๋ฅผ ํ•ด์ค€๋‹ค.

: Squash Merge๋Š” Git์—์„œ ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ปค๋ฐ‹์„ ํ•˜๋‚˜๋กœ ํ•ฉ์ณ์„œ ๋ณ‘ํ•ฉํ•˜๋Š” ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค. ์ด ๋ฐฉ๋ฒ•์€ ๋ณ‘ํ•ฉํ•  ๋ธŒ๋žœ์น˜์˜ ์ปค๋ฐ‹ ๊ธฐ๋ก์„ ์ •๋ฆฌํ•˜๊ณ , ํ•˜๋‚˜์˜ ์ปค๋ฐ‹์œผ๋กœ ํ†ตํ•ฉํ•˜์—ฌ ๋” ๊น”๋”ํ•œ Git ๋กœ๊ทธ๋ฅผ ์œ ์ง€ํ•˜๋Š” ๋ฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ฃผ๋กœ ๊ธฐ๋Šฅ ๊ฐœ๋ฐœ ๋ธŒ๋žœ์น˜๋ฅผ ๋ฉ”์ธ ๋ธŒ๋žœ์น˜์— ๋ณ‘ํ•ฉํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

728x90
๋ฐ˜์‘ํ˜•
LIST

๋Œ“๊ธ€