git merge, rebase merge, squash merge

movieยท2022๋…„ 8์›” 15์ผ
0

dev ์™€ feature ๋ธŒ๋žœ์น˜๋กœ ์—ฌ๋Ÿฌ ๊ฐœ๋…์„ ์ดํ•ดํ•ด๋ณด์ž! (merge์˜ ๊ธฐ๋ณธ ๋‹จ์œ„๋Š” branch)

  • dev : base branch
  • feature : dev ๋ธŒ๋žœ์น˜์—์„œ ๋‚˜๋ˆ ์ง„ ํ•˜์œ„ ๋ธŒ๋žœ์น˜

์˜ค๋Š˜ ์ƒ๊ฐํ•ด๋ณผ ๊ฒƒ โœ๏ธ

  • merge
    • fast-forward merge
    • non fast-forward merge
  • github์—์„œ์˜ ์—ฌ๋Ÿฌ ๊ฐ€์ง€์˜ merge
    • merge
    • rebase and merge
      • rebase
    • squash and merge


โ˜๏ธย fast-forward merge

feature๋ธŒ๋žœ์น˜๋ฅผ dev๋ธŒ๋žœ์น˜๋กœ ๋ณ‘ํ•ฉํ•  ๋•Œ dev๋ธŒ๋žœ์น˜์— ์ƒˆ๋กœ์šด ์ž‘์—… ๋‚ด์—ญ์ด ์—†๋‹ค๋ฉด merge commit ์—†์ด HEAD๋งŒ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค. ์ด๋ฅผ fast-forward(๋นจ๋ฆฌ ๊ฐ๊ธฐ) merge๋ผ๊ณ  ๋ถ€๋ฅธ๋‹ค.

  • ํ˜„์žฌ ๋ธŒ๋žœ์น˜(feature)์˜ HEAD๋ฅผ ๋Œ€์ƒ ๋ธŒ๋žœ์น˜(dev)์˜ HEAD๋กœ ์˜ฎ๊ธด๋‹ค.
  • ์ด๋Š” github์—์„œ ์ง€์›ํ•˜์ง€ ์•Š๋Š”๋‹ค. - ์ฐธ๊ณ 
  • ์šฐ๋ฆฌํŒ€์€ ๋ณดํ†ต github์—์„œ merge๋ฅผ ์ง„ํ–‰ํ•˜๋ฏ€๋กœ fast-forward๋Š” ๋ชป ์“ธ ๊ฒƒ ๊ฐ™๋‹ค.

  • fast-forward merge์˜ ๊ฒฐ๊ณผ๋ฌผ !

์ฆ‰, ์ƒ์œ„ ๋ธŒ๋žœ์น˜์— ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์—†์„ ๋•Œ๋งŒ fast-forward merge๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

โ˜๏ธย non fast-forward merge

  • ๋งŒ์•ฝ mergeํ•˜๋ ค๋Š” ์ƒ์œ„ ๋ธŒ๋žœ์น˜์— ๋ณ€๊ฒฝ์‚ฌํ•ญ์ด ์žˆ๋‹ค๋ฉด?
  • ์ด๋Ÿฐ ๊ฒฝ์šฐ์—๋Š” ์–‘์ชฝ์˜ ๋ณ€๊ฒฝ์„ ๊ฐ€์ ธ์˜ค๋Š” merge commit์ด ์žˆ์–ด์•ผ ํ•œ๋‹ค.

feature ๋ธŒ๋žœ์น˜์—์„œ ์ž‘์—…์„ ์™„๋ฃŒํ•˜๊ณ  dev ๋ธŒ๋žœ์น˜๋กœ ํ•ฉ์น˜๋ ค๋Š”๋ฐ, dev ๋ธŒ๋žœ์น˜์— ๋‹ค๋ฅธ ํ˜‘์—…์ž๋“ค์ด ์ž‘์—…ํ•œ ๊ฒฐ๊ณผ๋ฌผ์ด ์ƒˆ๋กœ commit๋˜์–ด dev ๋ธŒ๋žœ์น˜๊ฐ€ ๋‹ฌ๋ผ์กŒ๋‹ค๋ฉด?

  • feature ๋ธŒ๋žœ์น˜๋ฅผ dev์— mergeํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” dev ๋ธŒ๋žœ์น˜ ๋‚ด์˜ ๋ณ€๊ฒฝ ๋‚ด์šฉ๊ณผ feature ๋ธŒ๋žœ์น˜ ๋‚ด์˜ ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ํ•˜๋‚˜๋กœ ํ†ตํ•ฉํ•  ํ•„์š”๊ฐ€ ์žˆ๋‹ค.
  • ๋”ฐ๋ผ์„œ ์–‘์ชฝ์˜ ๋ณ€๊ฒฝ์„ ๊ฐ€์ ธ์˜จ merge commit์„ ์‹คํ–‰ํ•˜๊ฒŒ ๋œ๋‹ค.

  • ์ด๋ฅผ non fast-forward merge๋ผ๊ณ  ํ•œ๋‹ค. non fast-forward merge๋ฅผ ํ•˜๊ฒŒ ๋˜๋ฉด ๋ธŒ๋žœ์น˜๊ฐ€ ๊ทธ๋Œ€๋กœ ๋‚จ๊ธฐ ๋•Œ๋ฌธ์— ๊ทธ ๋ธŒ๋žœ์น˜๋กœ ์ž‘์—…ํ•œ ๋‚ด์šฉ๋“ค์„ ํ™•์ธํ•˜๊ธฐ์— ์œ ์šฉํ•˜๋‹ค.

โ˜๏ธ github์—์„œ์˜ ์—ฌ๋Ÿฌ๊ฐ€์ง€ merge

๋‚˜๋Š” ๋ณดํ†ต github ํŽ˜์ด์ง€์—์„œ ์‰ฝ๊ฒŒ merge๋ฅผ ์ง„ํ–‰ํ•œ๋‹ค.

github ํŽ˜์ด์ง€์—์„œ ํ•  ์ˆ˜ ์žˆ๋Š” merge๋Š” ์„ธ๊ฐ€์ง€๊ฐ€ ์กด์žฌํ•œ๋‹ค.

  1. create a merge commit
  2. squash and merge
  3. rebase and merge

์œ„์™€ ๊ฐ™์ด ์กด์žฌํ•˜๋Š”๋ฐ merge ๋ฒ„ํŠผ ์˜†์— ์žˆ๋Š” ํ† ๊ธ€์„ ์—ด๋ฉด merge option ๋“ค์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค. ๊ธฐ๋ณธ์œผ๋กœ๋Š” create a merge commit ์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ๋‹ค.

1๏ธโƒฃย create a merge commit

์•ž์—์„œ ์„ค๋ช…ํ•œ non fast-forward์ด๋‹ค. base ๋ธŒ๋žœ์น˜๋กœ merge๋ฅผ ์ง„ํ–‰ํ•  ๋•Œ merge commit์„ ํ†ตํ•ด ํ•ฉ์นœ๋‹ค.

merge ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด merge commit์„ ์ž‘์„ฑํ•˜๋Š” ์นธ์ด ๋‚˜์˜จ๋‹ค.

2๏ธโƒฃย squash and merge

๋‹ค์Œ์€ squash and merge์ธ๋ฐ, squash์˜ ์‚ฌ์ „์  ์˜๋ฏธ๋Š” ๋Œ€์ถฉ ๊ณผ์ผ ๊ฐ™์€ ๊ฒƒ์„ ์ญˆ์šฑ ์ฐŒ๋ถ€์‹œํ‚ค๋Š” ๊ฒƒ์ด๋‹ค. ๊ณผ์ผ ๋Œ€์‹ .. commit์„ ์ƒ๊ฐํ•ด๋ณด์ž!

dev ๋ธŒ๋žœ์น˜๋กœ mergeํ•˜๋Š” ์ƒํ™ฉ์„ ๊ฐ€์ •ํ–ˆ์„ ๋•Œ

์ด๋Ÿฐ์‹์œผ๋กœ merge๋˜๋Š” ๊ฒƒ์ด squash merge์ด๋‹ค.

feature ๋ธŒ๋žœ์น˜์˜ x, y, z ์ปค๋ฐ‹์„ ํ•˜๋‚˜๋กœ ์ญˆ์šฑ ํ•ฉ์ณ์„œ dev ๋ธŒ๋žœ์น˜๋กœ mergeํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค€๋‹ค.

  • x, y, z๋ฅผ ํ•ฉ์ณ์„œ ์ƒˆ๋กœ์šด ์ปค๋ฐ‹์„ ๋งŒ๋“ ๋‹ค.
  • ์ด ์ƒˆ๋กœ์šด ์ปค๋ฐ‹์€ dev ๋ธŒ๋žœ์น˜์˜ HEAD๋ฅผ parent๋กœ ๊ฐ–๋Š”๋‹ค.

squash and merge๋Š” ์–ด๋–จ ๋•Œ ์œ ์šฉํ•  ๊นŒ?

๋‚˜๋Š” ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์—์„œ ๋Œ€๋Œ“๊ธ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„ ์—ญํ• ์„ ๋งก์•˜๋‹ค.

ํ”„๋ก ํŠธ๋กœ์„œ ๋Œ€๋Œ“๊ธ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ์—ฌ๋Ÿฌ commit์„ ํ•  ๊ฒƒ์ด๋‹ค.

UI ๋งŒ๋“ค์–ด์•ผ์ง€ ..
mocking ํ•ด์•ผ์ง€ ..
ํ•จ์ˆ˜ ์—ฐ๊ฒฐํ•ด์•ผ ํ•˜์ง€ ..
์–ด ์Šคํƒ€์ผ ๋ง˜์— ์•ˆ ๋“œ๋„ค ๊ณ ์ณ์„œ commit ํ•ด์•ผ์ง• ..

์ด๋Ÿฐ์‹์œผ๋กœ ํ•œ ๊ธฐ๋Šฅ๋‹น ์—ฌ๋Ÿฌ commit์ด ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š”๋ฐ

์ด commit๋“ค์ด dev ๋ธŒ๋žœ์น˜ commit ๋‚ด์—ญ์— ๋‚จ๋Š”๋‹ค๋ฉด ๊ธฐ๋Šฅ ๋ณ„๋กœ commit log๋ฅผ ํ™•์ธํ•˜๋Š” ๋ฐ์— ์žˆ์–ด ๋ถˆํŽธํ•จ์„ ๊ฒฉ๊ฒŒ ๋˜๊ณ , ๋ฏธ๊ด€์ƒ์œผ๋กœ๋„ ์˜ˆ์˜์ง€ ์•Š๋‹ค.

๊ทธ๋Ÿฐ๋ฐ sqaush and merge ๊ธฐ๋Šฅ์„ ์ด์šฉํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด? ๋‚ด๊ฐ€ feature์—์„œ ์ž‘์—…ํ•œ ์ž‘์—…๋“ค์ด ํ•˜๋‚˜์˜ ์ปค๋ฐ‹์œผ๋กœ ํ•ฉ์ณ์ง€๊ฒŒ ๋œ๋‹ค.

์˜ˆ๋ฅผ ๋“ค๋ฉด ๊ธฐ๋Šฅ ํ•˜๋‚˜๋กœ ์ปค๋ฐ‹์ด ์ญˆ์•… ํ•ฉ์ณ์ง„๋‹ค. (dev ๋ธŒ๋žœ์น˜ commit log๋“ค์ด ์•„์ฃผ ์˜ˆ๋ป์ง)

๋‚ด๊ฐ€ feature ๋ธŒ๋žœ์น˜์—์„œ ์ง„ํ–‰ํ•œ commit๋“ค์€ ํ•ฉ์ณ์ง„ commit ํ•˜๋‚˜ ์† details๋กœ ๋‚จ๊ฒจ์ง„๋‹ค.

3๏ธโƒฃย rebase and merge

rebase and merge๋Š” ๋ญ˜๊นŒ? ์ผ๋‹จ ์ด๋ฅผ ์•Œ๊ธฐ ์ „์— rebase๊ฐ€ ๋ญ”์ง€ ์•Œ์•„์•ผํ•œ๋‹ค.

rebase

๋‘ ๊ฐœ์˜ ๊ณตํ†ต base๋ฅผ ๊ฐ€์ง„ branch์—์„œ ํ•œ branch์˜ base๋ฅผ ๋‹ค๋ฅธ branch์˜ ์ตœ์‹  commit์œผ๋กœ base๋ฅผ ์˜ฎ๊ธฐ๋Š” ์ž‘์—…! ์ด๋ฆ„์—์„œ ์•Œ ์ˆ˜ ์žˆ๋“ฏ์ด re ๋‹ค์‹œ base๋ฅผ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด๋‹ค.

์˜ˆ์‹œ๋กœ ํ•œ๋ฒˆ ์ดํ•ดํ•ด๋ณด์ž

ํ˜„์žฌ ๋‚˜๋Š” feature ๋ธŒ๋žœ์น˜์—์„œ ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๊ณ  ์žˆ๋‹ค.

feature ๋ธŒ๋žœ์น˜๋Š” dev ๋ธŒ๋žœ์น˜๋กœ๋ถ€ํ„ฐ ํŒŒ์ƒ๋œ ๋ธŒ๋žœ์น˜์ด๋ฉฐ b commit๊นŒ์ง€ ์Œ“์ธ ์ดํ›„ ๋‚˜๋Š” feature ๋ธŒ๋žœ์น˜๋ฅผ ์ƒ์„ฑํ–ˆ๋‹ค.

feature ๋ธŒ๋žœ์น˜์—์„œ x, y commit์„ ํ•˜๋ฉฐ ์—ด์‹ฌํžˆ ์ž‘์—…ํ•˜๊ณ  ์žˆ์—ˆ๋Š”๋ฐ

๋‚˜์˜ ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž๊ฐ€ c, d๋ผ๋Š” ์ž‘์—…์„ ์™„๋ฃŒํ•ด์„œ dev์— ๋จธ์ง€๋ฅผ ํ–ˆ๋‹ค.

dev ๋ธŒ๋žœ์น˜๋Š” ๊ทธ ์ „๊ณผ ์ž‘์—… ๋‚ด์šฉ์ด ๋‹ฌ๋ผ์กŒ๊ธฐ ๋•Œ๋ฌธ์— ๋‚ด๊ฐ€ ์ž‘์—…์„ ์™„๋ฃŒํ•˜๊ณ  dev๋กœ mergeํ•  ์‹œ๊ธฐ์— ์ถฉ๋Œ์ด ๋‚  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋‹ค. ์ด๋•Œ rebase๋ฅผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

rebase๋ฅผ ํ™œ์šฉํ•˜๋ฉด ๋‚ด ๋ธŒ๋žœ์น˜์˜ base commit์€ b์ง€๋งŒ dev์˜ ์ตœ์‹  ์ž‘์—… ๋‚ด์šฉ์ธ d๋กœ base commit์„ ๋ณ€๊ฒฝํ•  ์ˆ˜ ์žˆ๋‹ค! ์ฆ‰, ์ „๊ณผ ๋‹ฌ๋ฆฌ ์œ„์™€ ๊ฐ™์€ ๊ทธ๋ฆผ์ด ๋œ๋‹ค.

base๋ฅผ ๋ฐ”๊พผ๋‹ค๋Š” ๊ฒƒ์€ ์•Œ๊ฒ ๋Š”๋ฐ rebase๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์–ป๋Š” ์ด์ ์€ ๋ฌด์—‡์ผ๊นŒ?

1. dev ๋ธŒ๋žœ์น˜์˜ ์ตœ์‹  ๋ณ€๊ฒฝ์‚ฌํ•ญ์„ ์ฆ‰๊ฐ ๋ฐ˜์˜ํ•  ์ˆ˜ ์žˆ๋‹ค. (์ฆ‰, ์ตœ์‹  dev์˜ ์ตœ์‹  commit์„ ๋ฐ˜์˜ํ•˜๋ฉด์„œ ์ž‘์—…์„ ํ•ด์•ผํ•  ๋•Œ ์ข‹๋‹ค.)

์˜ˆ๋ฅผ ๋“ค์–ด, ๋‚˜๋Š” ๋Œ€๋Œ“๊ธ€์„ ์ž‘์—…ํ•˜๊ณ  ์žˆ๊ณ  ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž๋Š” ๋Œ“๊ธ€ ๋ถ€๋ถ„์„ ์ˆ˜์ •ํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ด๋ณด์ž. ๋Œ€๋Œ“๊ธ€์„ ์ž‘์—…ํ•˜๋Š” ๋™์‹œ์—, ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž์˜ dev ๋ธŒ๋žœ์น˜๋กœ merge๊ฐ€ ์™„๋ฃŒ๋œ ์ž‘์—…์„ rebase๋ฅผ ํ†ตํ•ด ๋ฐ”๋กœ ์ด์–ด๋ฐ›์•„ ์ž‘์—…์„ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.!

2. commit ์ด๋ ฅ์„ ๋‚จ๊ธฐ์ง€ ์•Š์•„ ๊น”๋”ํ•œ commit history๋ฅผ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.

๋งŒ์•ฝ ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž๊ฐ€ ํ•œ ์ž‘์—…(dev์— merge๋จ)์ด ๋‚˜์™€ ์ฝ”๋“œ์ƒ์—์„œ ์ถฉ๋Œ์ด ๋ฐœ์ƒํ•œ๋‹ค๋ฉด?

rebase๋ฅผ ํ™œ์šฉํ•˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•œ merge commit์„ push ํ•ด์•ผํ•ด์„œ commit history๊ฐ€ ๋”๋Ÿฌ์›Œ์ง„๋‹ค. ํ•˜์ง€๋งŒ rebase๋ฅผ ํ™œ์šฉํ•˜๋ฉด ๋‚ด commit๋“ค์ด ๋งˆ์น˜ ์ถฉ๋Œ์ด ๋ฐœ์ƒํ•˜์ง€ ์•Š์•˜๋˜ ๊ฒƒ์ฒ˜๋Ÿผ ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž commit ๋’ค์— ์œ„์น˜ํ•˜๊ฒŒ ๋˜๋ฏ€๋กœ ๊น”๋”ํ•˜๊ฒŒ commit history๋ฅผ ์œ ์ง€ํ•  ์ˆ˜ ์žˆ๋‹ค.

์–ด ๊ทธ๋Ÿฐ๋ฐ rebase๋ฅผ ํ–ˆ๋”๋‹ˆ ๊ณ„์† ๊ฐ™์€ ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•˜๋ž˜์š” ใ… ใ…  ์™œ์ด๋ž˜ ์ด๊ฑฐ

์ฒ˜์Œ rebase๋ฅผ ์•Œ์•˜์„ ๋•Œ ๊ณ„์† ์ถฉ๋Œ์ด ๋‚˜์„œ ๋‚˜๋Š” ๋‚ด๊ฐ€ ๋ญ˜ ์ž˜๋ชป ๋งŒ์กŒ๊ตฌ๋‚˜..๋งŒ ์ƒ๊ฐํ–ˆ์—ˆ๋‹ค.

ํ•˜์ง€๋งŒ ์ด๋Š” rebase์˜ ๊ณผ์ •์„ ์ƒ๊ฐํ•ด๋ณด๋ฉด ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋‹ค.

์ด ๊ทธ๋ฆผ์—์„œ ๋‹ค์‹œ ์ƒ๊ฐํ•ด๋ณด์ž.

๋งŒ์•ฝ ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž๊ฐ€ mergeํ•œ pr์˜ ์ž‘์—…(c, d)๋“ค์ด ๋‚˜์™€ ์ถฉ๋Œ์ด ๋‚˜๋Š” ์ž‘์—…์ด์—ˆ๋‹ค๋ฉด?

rebase๋ฅผ ๋”ฑ ์‹œ์ž‘ํ–ˆ์„ ๋•Œ, ๋‚ด commit์€ x, y๊ฐ€ ์กด์žฌํ•œ๋‹ค. ๋‚ด x, y๋Š” ๋ชจ๋‘ b๋ฅผ ๊ธฐ์ค€์œผ๋กœ ์ž‘์—…ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— x, y ๋‘˜ ๋‹ค d ๋’ค๋กœ ๋ณด๋‚ด์ฃผ๊ธฐ ์œ„ํ•ด์„œ๋Š” x, y ๋‘˜๋‹ค ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•ด์ฃผ์–ด์•ผ ํ•œ๋‹ค!

์ด๋Ÿฐ ์ด์œ ๋กœ ๊ณ„์† ์ถฉ๋Œ์„ ํ•ด๊ฒฐํ•˜๋ผ๋Š” ๋ฉ”์‹œ์ง€๊ฐ€ ๋–ด๋˜ ๊ฒƒ์ด๋‹ค!

์ด๋Š” rebase์˜ ๋‹จ์ ์œผ๋กœ ๊ผฝํžŒ๋‹ค. commit ๋งˆ๋‹ค ์ถฉ๋Œ์ฒ˜๋ฆฌ๋ฅผ ํ•ด์ฃผ์–ด์•ผ ํ•˜๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๋‹ค์‹œ rebase and merge๋กœ ๋Œ์•„์™€๋ณด์ž.

rebase and merge๋ฅผ ์ง„ํ–‰ํ•˜๋ฉด ์œ„์™€ ๊ฐ™์€ ๊ทธ๋ฆผ์ด ๊ทธ๋ ค์งˆ ๊ฒƒ์ด๋‹ค.

x commit์˜ base๋ฅผ b์—์„œ d๋กœ ๋ณ€๊ฒฝํ•˜๋ฉฐ merge๊ฐ€ ๋œ๋‹ค.

rebase and merge๋ฅผ ํ™œ์šฉํ•˜๋ฉด merge commit ์—†์ด merge๋ฅผ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ๊ณ ,

squash merge์™€๋Š” ๋‹ค๋ฅด๊ฒŒ ํ•˜๋‚˜์˜ ์ปค๋ฐ‹์œผ๋กœ ํ•ฉ์ณ์ง€์ง€ ์•Š๊ณ  pr์˜ commit ํ•˜๋‚˜ํ•˜๋‚˜ ์‚ด์•„์„œ dev ๋ธŒ๋žœ์น˜๋กœ merge ๋œ๋‹ค.



๊ฒฐ๋ก 

์šฐ๋ฆฌํŒ€์—์„œ๋Š” rebase๋ฅผ ํ•œ ํ›„, squash and mergeํ•˜๋Š” ์ „๋žต์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค.

๋งŒ์•ฝ ์Šฌ๋ž™์—์„œ ๋™๋ฃŒ ๊ฐœ๋ฐœ์ž ํ˜น์€ ๋‚˜์˜ PR์ด merge๋˜์—ˆ๋‹ค๋Š” ์•Œ๋ฆผ์ด ์˜ค๋ฉด rebase๋ฅผ ์ง„ํ–‰ํ•œ๋‹ค.

git fetch origin dev
git rebase origin/dev 

์œ„์™€ ๊ฐ™์ด ์ž…๋ ฅํ•˜๊ณ  rebase๋ฅผ ์ง„ํ–‰ํ•˜๋ฉฐ ์ถฉ๋Œ์ด ์žˆ๋‹ค๋ฉด ์ถฉ๋Œ์„ ํ•˜๋‚˜ํ•˜๋‚˜ ํ•ด๊ฒฐํ•ด์ค€๋‹ค.

(๋งŒ์•ฝ IDE์— ํ˜„์žฌ ์ž‘์—… ๋‚ด์šฉ์ด ์žˆ๋‹ค๋ฉด stash๋ฅผ ํ™œ์šฉํ•œ๋‹ค.)

rebase๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์ตœ์‹  ์ž‘์—…๋‚ด์šฉ์„ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๊ณ , ์ถฉ๋Œ ํ•ด๊ฒฐ์„ ์œ„ํ•œ commit์ด ์—†์–ด์ ธ์„œ ํ™œ์šฉํ•˜๊ณ  ์žˆ๋‹ค.

์ดํ›„, squash and merge๋ฅผ ์ง„ํ–‰ํ•˜๋Š”๋ฐ ์ด๋Ÿฌ๋ฉด dev์— ๊ธฐ๋Šฅ๋ณ„๋กœ commit์ด ์Œ“์ด๊ธฐ ๋•Œ๋ฌธ์— commit log๊ฐ€ ๊น”๋”ํ•ด์ ธ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค.

์ด๋Ÿฐ ๋Š๋‚Œ ~




์ฐธ๊ณ 

profile
์˜ํ™”๋ณด๊ด€์†Œ๋Š” ์˜ํ™”๊ด€ ๐Ÿ˜Ž

0๊ฐœ์˜ ๋Œ“๊ธ€