04. git 04 - nephilim/js-git-kata GitHub Wiki

2013-01-10

  • rebase 0. git-test.tgz ์••์ถ• ํ’€๊ธฐ - -from-line, -from-master ๋‘ ๊ตฐ๋ฐ์— ํ‘ผ๋‹ค
    1. git checkout
      • HEAD ์ด๋™ ํ™•์ธ: HEAD๋Š” ์ž‘์—… ํ•˜๋Š” ๋„์ค‘ ํ™œ๋ฐœ
      • cat .git/HEAD
    2. git checkout HEAD^
      • git branch: (no branch)
      • detached head
      • cat test.txt ์˜ˆ์ธก
        • checkout์€ workspace๋ฅผ ๊ฑด๋“œ๋ฆฌ๋Š” ๋ช…๋ น์–ด
    3. git checkout line
      • git reset vs git checkout
      • git reset HEAD^ ์˜ˆ์ธก
        • git checkout -- test.txt ์œผ๋กœ ๋™๊ธฐ
      • git reset --hard HEAD^
        • line, HEAD ๋™์‹œ ์ด๋™ ํ™•์ธ
        • checkout๊ณผ๋Š” ๋‹ฌ๋ฆฌ ํ˜„์žฌ reference๊ฐ€ ๋ชจ๋‘ ๋”ฐ๋ผ๊ฐ„๋‹ค
        • TODO: ์—ฐ์Šต ๋ฌธ์ œ
          • git merge(back-merge) ํ›„ merge commit์„ reset ํ•˜๊ธฐ
    4. git checkout 9c6da70
      • git reset (--hard)๋ฅผ ํ•˜์ง€ ์•Š์•˜์„ ๊ฒฝ์šฐ line ๋ธŒ๋žœ์น˜๊ฐ€ HEAD^ ์œ„์น˜์— ์žˆ๋Š” ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒ
    5. git rebase
      • start from master? line?
      • rebase์˜ ์ •์˜
    6. git reset --hard line
      • git reflog์—์„œ sha1 ํ™•์ธ
      • .git/refs/heads/master ์ˆ˜์ •
    7. git checkout 9c6da70(line)
      • git branch
      • git checkout line;git branch
    8. git rebase master
      • git add ํ•ด์•ผํ•จ
      • commit ์ˆœ์„œ ํ™•์ธ
    9. git checkout master && git merge line
      • ์šฉ์–ด: fast-forwarding
    10. (again)
    11. git checkout master
      • git branch
    12. git checkout -master
      • git branch
    13. git rebase line
    14. git branch -d line