10. git rerere - nephilim/js-git-kata GitHub Wiki
Git Rerere
definition
- REpeat REcorded REsoltion
- ๋ฆฌ๋ฆฌ๋
procedure
-
initial setting
- rr-cache ๋๋ ํ ๋ฆฌ ์์ฑ์ด ๋ชฉ์
git config --global rerere.enabled true
- ์ง์
.git/rr-cache
๋๋ ํ ๋ฆฌ๋ฅผ ์์ฑํด๋ ๋์ง๋ง, ๋ช ์์ ์ด์ง ์๋ค.
-
merging with rerere
-
initial setting์ ๋ง์ณค๋ค๋ฉด, merge ์ถฉ๋ ์ ๋ฉ์์ง๊ฐ ๋ค์๊ณผ ๊ฐ์ด ๋์จ๋ค
> git merge other_branch CONFLICT (content): Merge conflict in content.txt Recorded preimage for 'content.txt' ...
-
cd .git/rr-cache/xxxxxxx
-
preimage ํ์ธ ๊ฐ๋ฅ
<<<<<<< print "ohaio" ======= print "hello" >>>>>>>
-
-
git ls-files -u content.txt
100644 ea09e6edc6c043b8e5b8444ed0e7e0848a8d1879 1 content.txt 100644 367741c7e7d916e776f3e1e219ae11f0e16ee6f3 2 content.txt 100644 d14a4fdde0d436b1ec39e57913b00a56b4a09848 3 content.txt
- ์ถฉ๋ ์์ ์ ์ฌ์ฉ๊ฐ๋ฅ
- commit object๋ฅผ ์ถ์ ํด๋ณด๋ฉด ๊ฐ๊ฐ์ blob object๋ฅผ ํ์ธํ ์ ์์
-
git rerere status
- ์ด๋ค ํ์ผ์ ๊ธฐ๋กํ๋์ง ์๋ ค์ค
-
git rerere diff
- preimage ์์ diff
- this is what rerere will remember
-
CONFLICT edit
- git add & commit
- .git/rr-cache/postimage ํ์ธ
- Recorded resolution for 'content.txt' ํ์
- git add & commit
-
-
undo merge
- git reset --hard HEAD^
-
rebase topic branch
- git checkout branch
- git rebase master
- ๋ฉ์์ง ํ์ธ
- Resolved 'content.txt' using previous resolution
- ์ถฉ๋์์ ์ conflict ๋ด์ญ์ด ๊ฐ์ผ๋ฉด ๊ฐ์ ์ ๋ต์ ์ ์ฉํ๋ค
-
recreate conflicted file
- git checkout --conflict=merge content.txt
- content.txt์ ๊ด๋ จ merge ๋ด์ฉ์ ์์๋ธ๋ค
- ์ถฉ๋ ์์ ์ ์ฌ์ฉ ๊ฐ๋ฅ
- re-resolve
- git rerere๋ฅผ ํ๋ฉด conflict๊ฐ ์ ์ฉ๋จ
- git checkout --conflict=merge content.txt