๋ณธ๋ฌธ์œผ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

"ํ”„๋กœ์ ํŠธ" ํƒœ๊ทธ๋กœ ์—ฐ๊ฒฐ๋œ 1๊ฐœ ๊ฒŒ์‹œ๋ฌผ๊ฐœ์˜ ๊ฒŒ์‹œ๋ฌผ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋“  ํƒœ๊ทธ ๋ณด๊ธฐ

ยท ์•ฝ 3๋ถ„

Merge Options#

Merge#

๊ธฐ๋ณธ์ ์ธ Merge ๋ฐฉ๋ฒ•์œผ๋กœ ํ•˜๋‚˜์˜ ๋ธŒ๋žœ์น˜์˜ ๋ณ€๊ฒฝ ์ด๋ ฅ ์ „์ฒด๋ฅผ ํ•ฉ์น˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.

๋‘ ๋ณ€๊ฒฝ ์ด๋ ฅ์„ ๋ณ‘ํ•ฉํ•œ Merge commit์ด ์ƒˆ๋กœ ์ƒ์„ฑ๋œ๋‹ค.

2021-01-03-210103-image-0

Squash and merge#

๋ธŒ๋žœ์น˜ ์ƒ์˜ ๋ชจ๋“  ์ปค๋ฐ‹์„ ํ•˜๋‚˜๋กœ ๋ณ‘ํ•ฉํ•œ ๋‚ด์šฉ์„ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์— ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.

PR์— ์žˆ๋Š” commit log๋“ค์„ ํ•œ ๊ฐœ์˜ ์ปค๋ฐ‹์œผ๋กœ ์ถ”๋ ค์„œ main ๋ธŒ๋žœ์น˜์— ๋ณ‘ํ•ฉํ•  ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์—, 1 PR = 1 commit ์ฒ˜๋Ÿผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค.

2021-01-03-210103-image-1

์ฐธ๊ณ ์ž๋ฃŒ#

[Git] Merge ์ดํ•ดํ•˜๊ธฐ (Merge / Squash and Merge / Rebase and Merge)

6. Github์œผ๋กœ ํ˜‘์—…ํ•˜๋Š” ๋ฒ•

GitHub์˜ Merge, Squash and Merge, Rebase and Merge ์ •ํ™•ํžˆ ์ดํ•ดํ•˜๊ธฐ : TOAST Meetup

Rebase and Merge#

๋ธŒ๋žœ์น˜ ์ƒ์˜ ๋ชจ๋“  commit๋“ค์„ ํ•ฉ์น˜์ง€ ์•Š๊ณ  main ๋ธŒ๋žœ์น˜์— ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด๋‹ค.

2021-01-03-210103-image-2

GitHub๊ณผ GitLab์˜ Squash and merge ์ฐจ์ด#

GitHub#

Github์—์„œ๋Š” PR์— ๋Œ€ํ•œ ๋จธ์ง€ ๋ฐฉ๋ฒ•์„ ๋‹ค์Œ ์‚ฌ์ง„๊ณผ ๊ฐ™์ด ์ œ๊ณตํ•œ๋‹ค.

2021-01-03-210103-image-3

Squash and merge ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•  ๊ฒฝ์šฐ, Merge commit์ด ๋”ฐ๋กœ ์ƒ์„ฑ๋˜์ง€ ์•Š๊ณ , PR ํƒ€์ดํ‹€์„ ์ปค๋ฐ‹ ์ œ๋ชฉ์œผ๋กœ ํ•˜๊ณ , ๋ธŒ๋žœ์น˜์˜ commit log๋“ค์ด ์ปค๋ฐ‹ ๋‚ด์šฉ์œผ๋กœ ์ƒ์„ฑ๋œ๋‹ค.

2021-01-03-210103-image-4

GitLab#

๋ฐ˜๋ฉด, GitLab์—์„œ๋Š” MR์„ ๋จธ์ง€ํ•  ๋•Œ, Squash commits์˜ ์˜ต์…˜์„ ์ฒดํฌํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š”๋ฐ, GitHub๊ณผ ๋‹ฌ๋ฆฌ ๊ธฐ๋ณธ์ ์œผ๋กœ Merge commit์ด ์ƒ์„ฑ๋˜๋„๋ก ์„ค์ •๋˜์–ด ์žˆ๋‹ค.

2021-01-03-210103-image-5

Merge commit์„ ์ƒ์„ฑํ•˜์ง€ ์•Š๊ธฐ ์œ„ํ•ด์„œ๋Š” Fast-forward merge๋ฅผ ์‚ฌ์šฉํ•ด์•ผ ํ•œ๋‹ค.

Fast-forward merge requests

Fast-Forward Merge๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  Squash commits ์˜ต์…˜์„ ์ฒดํฌํ•˜์ง€ ์•Š์œผ๋ฉด, Rebase and Merge ์ฒ˜๋Ÿผ ๋™์ž‘ํ•œ๋‹ค.

Fast-Forward Merge๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  Squash commits ์˜ต์…˜์„ ์ฒดํฌํ•˜๋ฉด Squash and Merge ์ฒ˜๋Ÿผ ๋™์ž‘ํ•œ๋‹ค.

ํ•˜์ง€๋งŒ GitHub์—์„œ ์ž๋™์ ์œผ๋กœ ์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€ body์— ๋ธŒ๋žœ์น˜์˜ ์ปค๋ฐ‹ ๋กœ๊ทธ๋ฅผ ๊ธฐ๋กํ•ด์ฃผ๋Š”๋ฐ˜๋ฉด, GitLab์—์„œ๋Š” ์ปค๋ฐ‹ ๋กœ๊ทธ๋ฅผ ๊ธฐ๋กํ•ด์ฃผ์ง€ ์•Š๋Š”๋‹ค. Merge Request์˜ ๋‚ด์šฉ์ด ์žˆ๋‹ค๋ฉด์ด ๋‚ด์šฉ์„ ๋‹ด์„ ์ˆ˜ ์žˆ๊ณ , Modify commit message ๋ฒ„ํŠผ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ง์ ‘ ์ˆ˜์ •ํ•˜๋Š” ๊ฒƒ๋„๊ฐ€๋Šฅํ•˜๋‹ค.

2021-01-03-210103-image-6

์ฐธ๊ณ ์ž๋ฃŒ#

Merging a pull request

Merge requests