ํฐ์คํ ๋ฆฌ ๋ทฐ
๐๐ปโ๏ธ origin/main ๋ธ๋์น๊ฐ ์๋ฏธํ๋ ๊ฒ์?
๐ก ์๊ฒฉ ์ถ์ ๋ธ๋์น(remote teacking branches)
[remote]/[branch]
: ์๊ฒฉ ์ถ์ ๋ธ๋์น์ ํ ์์ธ origin.main์ remote์์ main๋ธ๋์น์ ๊ฐ์ฅ ๋ง์ง๋ง ์ปค๋ฐ์ ๊ฐ๋ฆฌํค๋ ํฌ์ธํฐ
โ๏ธ remote ๋ธ๋์น ์กฐํ
git branch -r
: git branch๋์ ๋ค๋ฅธ ๊ฒฐ๊ณผ๊ฐ ๋์ฌ ์ ์์!
- git branch์ ๋ชจ๋ remote branch๊ฐ ํฌํจ๋ ๊ฒ์ด ์๋!
- ์ฒ์์๋ remote์ default branch๋ง ํฌํจ๋จ!
๐๐ปโ๏ธ ๊ทธ๋ผ local์ ์๊ณ remote์๋ง ์๋ ๋ธ๋์น์์ ์์ ์ ํ๊ณ ์ถ๋ค๋ฉด?
git switch [remote-branch-name]
git checkout --track orijin/[remote-branch-name]
: remote-branch-name์ origin/branch-name ํ์์ด ์๋ branch-name๋ง!
: branch-name์ ๋ธ๋์น๋ฅผ ์๋ก ๋ง๋ค๊ณ , remote์ ๊ฐ์ ์ด๋ฆ์ ๋ธ๋์น๊ฐ ์์ผ๋ฉด ํด๋น ์๊ฒฉ ๋ธ๋์น๋ฅผ ์ถ์ ํ๋๋ก ์ค์ !
โ๏ธ Fetch / Pull
: remote์์ ๋ณ๊ฒฝ ์ฌํญ์ ๊ฐ์ ธ์ค๋ ๋ฐ ์ฌ์ฉ
โ๏ธ Fetch
: ์๊ฒฉ ์ ์ฅ์์์ ๋ณ๊ฒฝ ์ฌํญ์ ๋ค์ด๋ก๋ํ ์ ์์ง๋ง ์ด๋ฌํ ๋ณ๊ฒฝ ์ฌํญ์ workspace์ ์๋ ์์ ํ์ผ๊ณผ ํตํฉX
: ์ต์ ๋ณ๊ฒฝ ์ฌํญ์ ๊ฐ์ ธ์์ ์ปดํจํฐ์์ ์ ๊ทผํ ์ ์๊ฒํ๋ ๊ฒ
git fetch [remote]
: remote๊ฐ origin์ด๋ผ๋ฉด git fetch๋ง ํด๋ OK
git fetch [remote] [branch]
: ํน์ ๋ธ๋์น๋ง ํ์นญํ๊ธฐ
โ๏ธ Pull
: ์๊ฒฉ ์ ์ฅ์์์ ๋ณ๊ฒฝ ์ฌํญ์ ๊ฐ์ ธ์ค๊ณ HEAD ๋ธ๋์น๋ฅผ ์ ๋ฐ์ดํธ (๋ณ๊ฒฝ ์ฌํญ์ด workspace์ ์๋ ์์ ํ์ผ๊ณผ ํตํฉO)
: git pull = git fetch + git merge
git pull [remote] [branch]
โ์ด๋์ ๋ช ๋ น์ด๊ฐ ์คํ๋๋์ง๊ฐ ์ค์!! (๋ด๊ฐ main ๋ธ๋์น์ ์๋ค๋ฉด main ๋ธ๋์น๋ก ํด๋น remote ๋ธ๋์น๋ฅผ pullingํจ)
git pull
: ํ์ฌ ๋ด๊ฐ ์์นํ ๋ธ๋์น์ ๋ง๊ฒ pulling (๋ด๊ฐ main ๋ธ๋์น์ ์๋ค๋ฉด local main๋ธ๋์น๋ก ํด๋น remote main๋ธ๋์น๋ฅผ pullingํจ)
โgit pull์ ํ๋ฉด ์ถฉ๋์ด ๋ฐ์ํ ์ ์์!
๐ก ๋ณํฉ์ถฉ๋๊ณผ ๋๊ฐ์ด ํด๊ฒฐ
'๋ฒ์ ๊ด๋ฆฌ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[GitHub] Github ์ด๋ชจ์ ๋ชจ (0) | 2023.07.09 |
---|---|
[GitHub] ๊นํ๋ธ์ ๊ธฐ์ด (0) | 2023.07.09 |
[Git] ๋ณ๊ฒฝ์ฌํญ ์ทจ์ํ๊ธฐ ๋ฐ ์๊ฐ์ฌํ (0) | 2023.07.09 |
[Git] ์คํ์(Stash)์ ๋ชจ๋ ๊ฒ (0) | 2023.07.08 |
[Git] Git Diff๋ก ๋ณ๊ฒฝ์ฌํญ ๋น๊ตํ๊ธฐ (0) | 2023.07.08 |