Commit Head๋ž€?

๐Ÿ“„ HEAD๋ž€?

ํŒŒ์ผ์„ commitํ•  ๋•Œ, ํ˜„์žฌ commitํ•œ ํŒŒ์ผ์€ ์ด์ „ commitํ•œ ํŒŒ์ผ์„ ์ฐธ์กฐํ•ฉ๋‹ˆ๋‹ค.

a b c d ์ˆœ์œผ๋กœ commitํ•œ๋‹ค๊ณ  ๊ฐ€์ •ํ•  ๋•Œ, b๋Š” a๋ฅผ ๊ฐ€๋ฆฌํ‚ค๊ณ  c๋Š” b๋ฅผ ๊ฐ€๋ฆฌํ‚ต๋‹ˆ๋‹ค.

์ด๋Ÿฐ์‹์œผ๋กœ commit์„ ํ•ด ๋‚˜๊ฐ€๋Š” ๊ธฐ๋ณธ ์ค„๊ธฐ๋ฅผ master branch ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

a <- b<- c<- d (์‹œ๊ฐ์  ํ‘œํ˜„)

์ด master brach์—์„œ HEAD๋Š” ๋งˆ์ง€๋ง‰์œผ๋กœ commitํ•œ dํŒŒ์ผ์„ ๊ฐ€๋ฆฌํ‚ค๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

์ด๋•Œ c๋Š” head~1์ด ๋˜์–ด head๊ฐ€ ์žˆ๋Š” ๊ณณ์—์„œ ์ฒซ ๋ฒˆ์งธ ๋ถ€๋ชจ์ž„์„ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

b๋„ ๋งˆ์ฐฌ๊ฐ€์ง€๋กœ head~2๊ฐ€ ๋ฉ๋‹ˆ๋‹ค.

๋งŒ์•ฝ, b๋กœ ๋Œ์•„๊ฐ€๊ณ  ์‹ถ๋‹ค๋ฉด

git checkout bํ•ด์‰ฌํƒœ๊ทธ

๋ฅผ ์ž…๋ ฅํ•˜์—ฌ b๋กœ ๋Œ์•„๊ฐˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

git checkout

git checkout master

์œ„์™€ ๊ฐ™์ด ์ž…๋ ฅํ•˜๋ฉด ๋‹ค์‹œ ์›์ƒํƒœ๋กœ ๋Œ์•„์˜ต๋‹ˆ๋‹ค.

์ฐธ๊ณ 

  • ๋“œ๋ฆผ์ฝ”๋”ฉ

Leave a comment