[220705 / Day 36] Git : 3-Way-Merge, rebase, Stashing, Story Book
1. 3-Way-Merge : !!! ๋ค์ ์ค๋ช !!!
์์ธํ๊ฒ ๋์ค์ง๋ง ๊ฐ์ง๊ฐ ์ง์ ๋ถํด์ ธ์ ๋ง์ด ์ ํธํ์ง ์์
1)
checkout : ๋ธ๋์น ์ ํ์๋ง ์ฐ๋ ๋ช ๋ น์ด๊ฐ ์๋
switch : ์๋ก์๊ธด ๋ธ๋์น ์ ํ์ ์ฐ๋ ๋ช ๋ น์ด
2) ์ต์คํ ์ ์ผ๋ก ๋ ์ง๊ด์ ์ผ๋ก ๋ณด๊ธฐ
git graph ์ค์น, ์ผ์ชฝ์ ๊ฒ์๋ฒํผ ๋ฐ์ ํด๋ฆญ, ์ฒดํฌ ๋ฒํผ ์์์ ๊ทธ๋ํ ๋ฒํผ ํด๋ฆญํ๋ฉด log graph ์ง๊ด์ ์ด๊ฒ ํ์๋์ด ๋์ด
2. rebase ๋ฆฌ๋ฒ ์ด์ค : ๊ทธ๋ํ์์ ๋จธ์ง๋ผ๊ณ ์์ธํ๊ฒ ํ์ํ๊ณ ์ถ์ง ์๋ค !!! ๋ค์ ์ค๋ช !!!
๋ฆฌ๋ฒ ์ด์ค๋ ์๋ฆฌ๋ฅผ ๋์ผ๋ก ์ฎ๊ฒจ์ฃผ๋ ๊ฒ
git rebase main : 3์จ์ด ์ปค๋ฐ์ผ๋ก ๊ฐ์ง๊ฐ ์๊ธด ๊ฒ์ ๊น๋ํ๊ฒ ํฉ์ณ์ ธ ์์
!!! ์ฃผ์ : ???
1) switch ๋ก ์ด๋ํ๋ฉด์ ๋ง๋ค๊ธฐ
git switch -c new : -c ๋ create
!! ๊ณผ์ : newb ๋ธ๋์น ๋ง๋ค๊ณ , newb.html ์์ฑ, commit ๊ธฐ๋ก, ๋ฉ์ธ์์ f.html ์์ฑ, commit ๊ธฐ๋ก, newb ๋ฅผ ๋ฆฌ๋ฒ ์ด์ค, ํ์คํธ ํฌ์๋๋ก ๋จธ์ง
→ ์ฝ๋ฉ
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git switch -c newB
Switched to a new branch 'newB'
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (newB)
$ git add .
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (newB)
$ git commit -m 'add newB.html'
[newB 76d34b2] add newB.html
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 newB.html
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (newB)
$ git switch main
Switched to branch 'main'
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git add .
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git commit -m 'add f.html in main'
[main 9631ae8] add f.html in main
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 f.html
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git rebase main
Current branch main is up to date.
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git rebase newB
Successfully rebased and updated refs/heads/main.
2) rebase --onto
ํน์ ์์ ๋ง ํ์ ๋ ํด๋น ์์ ์ ๋จผ์ ์ฌ๋ฆด ๋
- ๊ตฌ์กฐ : main - subA - subA-dep1
- ํ๋ ๋ฒ :
$ git rebase --onto main subA subA-dep1
→ ๋ฉ์ธ์๋ค๊ฐ ์๋ธ์์ด ๋ฐ์ ์๋ ์๋ธ์์ด๋1์ ์ฌ๋ฆด ๊ฒ
→ ๊ทธ๋๊น ์๋ธ์์ด๋1 ์ ๋ฉ์ธ์ ์ฌ๋ผ๊ฐ ์์
- ์ฝ๋ฉ :
$ git branch
* main
new
newB
→ ๋ฉ์ธ์์ ๋ธ๋์น ํ์ธ
$ git branch -d new
→ ๋ฉ์ธ์์ new ๋ธ๋์น ์ญ์
$ git switch -c subA
→ ๋ฉ์ธ์์ subA ๋ธ๋์น ๋ง๋ค๊ณ ์ด๋
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (subA)
$ git add .
→ subA ์์ subA-1.html ํ์ผ ์์ฑํ๊ณ subA ๋ธ๋์น์ add
$ git commit -m 'add subA-1.html in subA'
→ subA ์์ subA-1.html ํ์ผ commit
$ git add .
→ subA ์์ subA-2.html ํ์ผ ์์ฑํ๊ณ subA ๋ธ๋์น์ add
$ git commit -m 'add subA-2.html in subA'
→ subA ์์ commit
$ git logstory
→ subA ์์ ๊ทธ๋ํ ํ์ธ
$ git branch subA-dep1
→ subA ์์ subA-dep1 ๋ธ๋์น ์์ฑ
$ git switch subA-dep1
→ subA-dep1 ๋ก ์ด๋
$ git add .
→ subA-dep1 ์์ dep1.html ํ์ผ ์์ฑ ํ add
$ git commit -m 'add dep1.html subA-dep1'
→ subA-dep1 ์์ commit
$ git switch subA
→ subA-dep1 ์์ subA ๋ก ์ด๋
$ git swich main
→ subA ์์ main ์ผ๋ก ์ด๋
$ git rebase --onto main subA subA-dep1
→ main ์์ subA ๋ฐ์ subA-dep1 ์ ๋ณํฉ
!!!!!!!
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (subA-dep1)
$ git merge subA-dep1
Already up to date.
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (subA-dep1)
$ git switch main
Switched to branch 'main'
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git branch -d subA-dep1
error: The branch 'subA-dep1' is not fully merged.
If you are sure you want to delete it, run 'git branch -D subA-dep1'.
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git branch
* main
newB
subA
subA-dep1
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git branch -d subA-dep1
error: The branch 'subA-dep1' is not fully merged.
If you are sure you want to delete it, run 'git branch -D subA-dep1'.
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git branch -D subA-dep1
Deleted branch subA-dep1 (was 4c27b86).
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git branch
* main
newB
subA
kimhy@LAPTOP-9MVGLEHR MINGW64 ~/Desktop/git/Helpgitbox (main)
$ git switch subA
Switched to branch 'subA'
3. ์คํ ์ฑ Stashing
- ์์์ ์ฅ : ์ปค๋ฐ ์ํ๊ณ ๋๊ฐ๋ฉด ๋ค ๋ฉ์ธ์ผ๋ก ์ธ์ด๋ธ ๋๋๋ฐ, ์ปค๋ฐ์ ์ํ๊ณ ๋๊ฐ ์ผ์ด ์์ ๋ ์ฐ๋ ๊ฒ
- git stash : ์์ ์ ์ฅ์์ ๋ณด๋ด์ฃผ๋ ๊ฒ
- ์ด๋ฆ๊ณผ ๋ฉ์์ง๋ฅผ ๋ฃ๊ณ ์์ ์ ์ฅ์๋ก ๋ณด๋ด์ฃผ๊ณ ์ถ์ผ๋ฉด :
$ git add .
$ git stash push -m 'subA ing'
→ ์ด๋ ๊ฒ ํ๋ฉด ์์์ ์ฅ์๋ก html ํ์ผ์ด ๊ฐ๊ธฐ ๋๋ฌธ์ ์ ๋ณด์
$ git stash list
stash@{0}: On subA: subA ing
→ ์์์ ์ฅ์ ํ์ธ, stash ์ subA ๊ฐ ๋ค์ด๊ฐ๋ค๊ณ ๋์ด
$ git stash push -m 'subA-4 ing'
→ ๋ ํ๋ ์์์ ์ฅ์๋ก ๋ณด๋ด๊ณ
$ git stash list
stash@{0}: On subA: subA-4 ing
stash@{1}: On subA: subA ing
→ ํ์ธํด๋ณด๋ฉด 0, 1 ๋ก ๋์ด
$ git stash apply stash@{1}
→ ์์์ ์ฅ์์ ๋จ๊ธฐ๋ฉด์ ํ์ผ ๋ถ๋ฌ์ค๊ธฐ
$ git stash list
stash@{0}: On subA: subA-4 ing
stash@{1}: On subA: subA ing
→ ํ์ธํด๋ณด๋ฉด ๋จ์์๋๋ฐ subA ์๋ ํ์ผ ์กด์ฌ
$ git stash pop stash@{0}
→ ๋ฆฌ์คํธ์์ ์ญ์ ํ๋ฉด์ ํ์ผ ๋ถ๋ฌ์ค๊ธฐ
$ git stash list
stash@{0}: On subA: subA ing
→ ์ญ์ ๋ ๊ฒ ํ์ธ ๊ฐ๋ฅ
$ git stash drop stash@{0}
→ ์์์ ์ฅ์์์ ์ญ์ , list ๋ก ํ์ธํด๋ณด๋ฉด 0 ๋ฒ ํ์ผ ์ญ์ ๋จ
4. Story Book ์คํ ๋ฆฌ๋ถ
https://storybook.js.org/tutorials/intro-to-storybook/react/ko/get-started/
- ๋์์ธ ๋ญ๊ท์ง(๊ธฐ๋ณธ์ ์ธ ๋ฒํผ, ์์คํ ๋ชจ์ ๋ฑ) ๋ฅผ ์ปดํฌ๋ํธํ, ๋ผ์ด๋ธ๋ฌ๋ฆฌํ