03. git 03 - nephilim/js-git-kata GitHub Wiki
2013-01-07
-
์งํ ์์ฝ
- branch
- ์์ฑ: git branch ${branch-name}
- ์ญ์ : git branch -d ${branch-name}
- ์: ๋ด์ฉ ์์ ํ branch ์ด๋
- ๋๋ ๊ฒฝ์ฐ, ์๋๋ ๊ฒฝ์ฐ
- start
- line1/line2 >> test.txt
- extra: line3/line4 add (with others)
- 'detached head' state
- (no branch) state
- git checkout origin
- 'line5' add (no branch)
- 'line6' add (master)
- git checkout -b ${branchname}
- git graph๋ก ํ์ธ
- merge
- git์ merge ๊ฒฐ๊ณผ๊ฐ ์๋ก์ด commit์ผ๋ก ์ถ๊ฐ๋๋ค
- ์คํจ์ ์๋ก์ด commit ์ถ๊ฐ ์ง์ ์ ๋ฉ์ถค
- ์ฃผ์ ์ต์ no-ff
- merge ์ทจ์์ ๋ํ ์ฃผ์ ๋ฒ์น
- ๋๊ตฌ๊ฐ์๊ฒ merge ๋นํ commit object๋ ์ฝ๊ฒ ์ทจ์๊ฐ ๋์ง ์๋๋ค.
- ์๋์ ๋ด์ฉ์ ์ํฅ์ ์ฃผ์๊ธฐ ๋๋ฌธ์ ์๋ ๋ํ ์์ ์ ํด์ผํ๋ค.
- ๋๊ตฐ๊ฐ๋ฅผ mergeํ commit object๋ ์ทจ์ํ ์ ์๋ค.
- ์๋์ ๋ด์ฉ์ ์ํฅ์ ์ค ๊ฑด ์๋๊ธฐ ๋๋ฌธ์ merge commit์ ์ทจ์ํ๋ฉด ๋๋ค.
- ๋๊ตฌ๊ฐ์๊ฒ merge ๋นํ commit object๋ ์ฝ๊ฒ ์ทจ์๊ฐ ๋์ง ์๋๋ค.
- merge ํ ์ผ๋ถ ๋ธ๋์น ๋ณํฉ ์์๋ ์ผ๋ก ํ๊ธฐ๋ ๋ฐ๋์ ์์ ๋ก ์ถ๊ฐํ๋ค.
- merge ํ ์ถฉ๋์ด ๋๋ฉด: CONFLICT
-
git status๋ก
You have unmerged paths.
๋ฉ์์ง ํ์ธ์ด ๊ฐ๋ฅํ๋ค. -
git ls-files -u
-
list conflicting blobs(3)
> git ls-files -u contents 100644 ee3ecd22c807354b4cea36b827e76c0285c9e401 1 contents 100755 4c5ac21ed599a93e7523bbc62ed928c18364d9b8 2 contents 100644 ecb08d9d0b10ee5bc16f1030da048596c90a7504 3 contents
-
-
git checkout --conflict=merge contents
> cat contents <<<<<<< ours print "ohaio" ======= print "hello" >>>>>>> theirs
-
- patch
- git format-patch -M
- git show --pretty=email
- rebase
- git rebase ${target-branch}
- git rebase --onto master server client
- clien - server > master
- branch ๋ช
์ ์ฐ๋ฉด ๋ฐ๋ผ๊ฐ๋ค.
- git rebase --onto 1f3d63c HEAD feature-03
- git rebase --onto master server client
- from common parent, make patch in current branch
- apply the patch to the target branch
- conflict? (no branch)
- git rebase --continue
- git rebase --interactive
- todo: HEAD๋ก fast-forwardingํ๊ธฐ
- git checkout master && git merge
- git rebase ${target-branch}
- cherry-pick
- git cherry-pick ${changeset}
git am
can be better than cherry-pick since it doesn't create a remote
- merge vs rebase
- rebase hell
- ํน์ ๊ธฐ๋ฅ์ด branch์ ํตํฉ๋์ด์ผ ํ ๊ฒฝ์ฐ
- ๊นจ๋ํ history
- rebase์ ์ํ์ฑ
- git pull
- = git fetch + git merge
- git clone ...-cloned
- git remote๋ก ํ์ธ
- fetch๋ก ์ฌ๋ฌ branch ๊ฐ์ ธ์ค๊ธฐ?
- remote: cloned๋ฅผ test์ ๋ฑ๋กํ๊ณ cloned์์ ๊ฒฐ๊ณผ ๊ฐ์ ธ์ค๊ธฐ
- ์ถ์ ๋ธ๋์น ๋ง๋ค๊ธฐ
- git checkout -b hotfix-10280 cloned/hotfix-10280
- git clone์ ๊ฒฝ์ฐ ์๋์ผ๋ก ์ถ์ ๋ธ๋์น๋ฅผ ์์ฑํด ์ค
- git pull --rebase
- pull merge ๋์ rebase
- discuss: ๊ณผ๊ฑฐ ์ด๋ ฅ ์์ ํ๊ธฐ
- git commit --amend ๋ ์ ํฉํ์ง ์์
- answer? git rebase -i
- branch
-
์ค์ต
- "์ค๋์ commit message" ์์ ํ๊ธฐ
- git rebase -i