๐Ÿ’พ git_VSํ„ฐ๋ฏธ๋„

๊น€์ง€ํ˜œยท2023๋…„ 6์›” 16์ผ
0

git & Github

๋ชฉ๋ก ๋ณด๊ธฐ
1/10
post-custom-banner

๐Ÿ”— vs ํ„ฐ๋ฏธ๋„ commit

๐Ÿ”— commit

add

ํŠน์ • ํŒŒ์ผ ์ €์žฅ

git add (ํŒŒ์ผ๋ช…)

ํŒŒ์ผ ์ „์ฒด ์ €์žฅ

git add .

status

์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ ์ƒํƒœ ํ™•์ธ

git status

commit

git commit

git commit -m '(๊ธฐ๋ก)'

log

log (commit ๋‚ด์—ญ ํ™•์ธ)

git log --all --oneline

diff

commit ์ „ vs ํŒŒ์ผ ์ฐจ์ด์  ๋ณด์—ฌ์คŒ

git diff

๐Ÿ”— Branch

branch

๋ธŒ๋žœ์น˜ ์ƒ์„ฑ

git branch (๋ธŒ๋žœ์น˜๋ช…)

switch

๋ธŒ๋žœ์น˜ ์ด๋™

git switch (๋ธŒ๋žœ์น˜๋ช…)

์ƒํƒœ์ฐฝ

git status

commit

git add .
git commit -m '(๋ฉ”์‹œ์ง€)'
  • ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜ ์ด๋™ ์‹œ
    Ex. A branch > B branch ์ด๋™ ์‹œ A branch์˜ ํŒŒ์ผ์ด B branch์˜ ํŒŒ์ผ์—๋Š” ์—†์Œ.
    git branch A > git switch B

EX. A branch์˜ A ํŒŒ์ผ > B branch์—๋Š” A ํŒŒ์ผ ์กด์žฌ X

commit & branch ๊ทธ๋ž˜ํ”„ ํ™•์ธ

git log --oneline --all --graph

๋ธŒ๋žœ์น˜ ์ด๋ฆ„ ๋ณ€๊ฒฝ

git checkout -m branch-name
git branch -m new-branch-name

-> ํ•ด๋‹น ๋ธŒ๋žœ์น˜ ์ฒดํฌ

merge

branch ํ•ฉ์น˜๊ธฐ (ํ˜„์žฌ branch์— ์ ‘์†ํ•œ ์ƒํƒœ๋กœ ๋ช…๋ น์–ด ์ž…๋ ฅ)

git merge (ํ•ฉ์น  branch ์ž…๋ ฅ)

์ถ”๊ฐ€(+)

git checkout target_branch  // ๋Œ€์ƒ ๋ธŒ๋žœ์น˜๋กœ ์ด๋™
git merge source_branch     // ์†Œ์Šค ๋ธŒ๋žœ์น˜๋ฅผ ๋Œ€์ƒ ๋ธŒ๋žœ์น˜๋กœ ๋จธ์ง€
  • Good
    = ๋ฌด์‚ฌํžˆ branch๊ฐ€ ํ•ฉ์ณ์ง.
    EX.
    A branch์˜ A ํŒŒ์ผ + B branch์˜ B ํŒŒ์ผ์ด ํ•ฉ์ณ์ง(A ํŒŒ์ผ =/= B ํŒŒ์ผ)

  • Bed
    = branch๊ฐ€ ๋™์ผ ์ฝ”๋“œ ์ˆ˜์ •์ธ ๊ฒฝ์šฐ ์ถฉ๋Œ(conflict)์ด ๋ฐœ์ƒํ•จ.
    EX.
    A branch์˜ A ํŒŒ์ผ + B branch์˜ A ํŒŒ์ผ(A ํŒŒ์ผ == A ํŒŒ์ผ)
    -> ์ฝ”๋“œ/ํŒŒ์ผ ์ถฉ๋Œ(conflict) ๋ฐœ์ƒ

=> ์ถฉ๋Œ(conflict) ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•(์ˆ˜๋™)
1. ์ถฉ๋Œ ๋ฐœ์ƒ ์‹œ ์›ํ•˜๋Š” ์ฝ”๋“œ/ํŒŒ์ผ ์ œ์™ธ ์ˆ˜์ •/์‚ญ์ œ
2. git add
3. git commit

post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€