git pull์ด ์•ˆ๋ ๋•Œ๐Ÿคฌ_git branch divergent

์œ ๋ฆผยท2022๋…„ 7์›” 23์ผ
0

๐Ÿ’กdding's TIL

๋ชฉ๋ก ๋ณด๊ธฐ
1/41

ํ•ญ์ƒ git์—๊ฒŒ ํ•ญ์ƒ ์กŒ์—ˆ์ง€๋งŒ..!
์˜ค๋Š˜ ์ฒ˜์Œ์œผ๋กœ br์˜ ๋„์›€์œผ๋กœ ๋‹คํ–‰ํžˆ ์„ ๋ฐฉํ–ˆ๋‹ค.. ํœด ๐Ÿ˜•

git pull์„ ํ•˜๋Š”๋ฐ ์•„๋ž˜์™€ ๊ฐ™์€ ๋ฉ”์‹œ์ง€๊ฐ€ ๋œจ๋ฉด์„œ ๊ณ„์† pull์ด ์•ˆ๋๋‹ค
:hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:

git์˜ branch๊ฐ€ divergent๋˜์–ด์žˆ๋‹ค๋Š” ๋ง์ด๋‹ค

๊ทผ๋ฐ ๋‚ด๊ฐ€ branch๋ฅผ ๋‚˜๋ˆˆ์ ์€ ๊ฒฐ์ฝ”์—†๋Š”๋ฐ ์ •๋ง๋กœ....์ง„์‹ฌ์œผ๋กœ...์–ต์šธ....๐Ÿฅฒ
pullํ•˜๊ณ  ์žˆ์„ ๋•Œ ๋‹ค๋ฅธ ์‚ฌ๋žŒ์ด push๋ฅผ ํ–ˆ์„ ๋•Œ..? ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ๋Š” ์ผ์ด ์—†์—ˆ๋Š”๋ฐ branch๊ฐ€ ๋‚˜๋‰˜์–ด์ ธ์žˆ์—ˆ๋‹ค

github branch์—๋Š” ์—ฌ์ „ํžˆ main๋ธŒ๋žœ์น˜ ๋ฐ–์— ์—†๋Š”๋ฐ ๋‚˜๋‰˜์–ด์กŒ๋‹ค๋‹ˆ ๋” ๋‹ต๋‹ตํ• ๋”ฐ๋ฆ„ ....

ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ฒฐ๊ตญ branch์˜ commit history๋ฅผ ์ •๋ฆฌํ•ด์ค˜์•ผํ•œ๋‹ค

history๋ฅผ ์ •๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์€ 2๊ฐ€์ง€์ธ๋ฐ

1) branch๋ฅผ merge ๋˜๋Š” 2) branch rebase ์ค‘ ์„ ํƒํ•ด์„œ ํ•˜๋ฉด ๋œ๋‹ค

๊ทธ ์ค‘ ๋‚˜๋Š” mergeํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์„ ํƒํ–ˆ๋‹ค

branch๋ฅผ mergeํ•˜๋ ค๋ฉด?

1. git config pull.rebase false 
 - ๋•Œ๋ฌธ์— rebase๋ฅผ ํ•˜๋ ค๋ฉด false๊ฐ€ ์•„๋‹ˆ๋ผ true๊ฐ€ ๋˜๋„๋ก ํ•ด์ค˜์•ผํ•œ๋‹ค 
 
2. git status
 - ์ œ๋Œ€๋กœ ๋๋Š”์ง€ ํ™•์ธ, ๋งž๋Š” ๋ธŒ๋žœ์น˜์— ์žˆ๋Š”๊ฒƒ์ธ์ง€ ์žฌํ™•์ธํ•ด์ฃผ๊ธฐ ์œ„ํ•จ
 
3. git git commit -m"์ปค๋ฐ‹ํ•  ์ด๋ฆ„"

4. git push origin main 

๊ฐ„๋‹จํ•ด ๋ณด์ด์ง€๋งŒ ๊ผญ!! ์ฃผ์˜ํ•ด์•ผํ•  ๋ถ€๋ถ„!!

  • ๋ณ€๊ฒฝ์‚ฌํ•ญ์—†์ด commit, pushํ•˜๋ฉด
"Everything up-to-date"

์ด ๋ฌธ๊ตฌ๋งŒ ๊ณ„์† ๋‚˜์˜ค๊ธฐ ๋•Œ๋ฌธ์— ์กฐ๊ธˆ์ด๋ผ๋„ ์ˆ˜์ •์„ ํ•ด์„œ commit์„ ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅํ•œ๋‹ค
๋‹น์žฅ ์ด ์ดˆ์กฐํ•œ ๋งˆ์Œ์— push๋˜๋Š” ๊ณผ์ •์„ ๋ณด๊ณ ์‹ถ์€....๋งˆ์Œ์œผ๋กœ... ์ง„ํ–‰ ใ…Žใ…Ž

์•„๋ž˜ ์ด๋ฏธ์ง€๋Š” ๋‚ด๊ฐ€ mergeํ•˜๋ฉด์„œ ์ˆ˜์ •์‚ฌํ•ญ์—†์ด commit,pushํ•˜๋‹ค๊ฐ€ ์ง€์ €๋ถ„ํ•ด์ง„ ์ง„ํ–‰ ๊ณผ์ •์ด๋‹ค (๋งˆ์ง€๋ง‰ pushํ•˜๋Š” ํ•œ์ค„์€ ์บก์ฒ˜ํ•  ๋•Œ ํ•œ ํ™”๋ฉด์— ์•ˆ๋‚˜์™€์„œ ๋ชปํ•œ์  ์–‘ํ•ด๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค..)

profile
ษช สœแดแด˜แด‡ แด›แด sแดสŸแด แด‡ ส€แด‡แด€สŸ แด˜ส€แดส™สŸแด‡แดs๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ปโค๏ธ

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