๐Ÿ“ETC./โš’๏ธ Tool

[Github] ๊นƒ(git) ์‚ฌ์šฉํ•˜๊ธฐ

yujch 2022. 5. 3. 02:52
๋ฐ˜์‘ํ˜•

 

์ƒํƒœ

#๊นƒ ์ƒํƒœ ํ™•์ธ
git status

 


ํด๋ก  (clone)

#๊ธฐ๋ณธ master ๋ธŒ๋ Œ์น˜ ํด๋ก 
git clone {git ์ €์žฅ์†Œ URL} {์ƒ์„ฑํ•  ํด๋”๋ช…}

#ํŠน์ • ๋ธŒ๋ Œ์น˜ ํด๋ก 
git clone -b {branch_name} --single-branch {git ์ €์žฅ์†Œ URL} {์ƒ์„ฑํ•  ํด๋”๋ช…}

- {์ƒ์„ฑํ•  ํด๋”๋ช…}์„ ์ ์ง€์•Š์œผ๋ฉด git์œผ๋กœ ๋ถˆ๋Ÿฌ์˜ค๋Š” repository์˜ ์ด๋ฆ„์œผ๋กœ ์ƒ์„ฑ๋จ

 


์ปค๋ฐ‹ (commit)

git commit -m "์ปค๋ฐ‹ ๋ฉ”๋ชจ"

 


ํ‘ธ์‹œ (push)

#master ๋ธŒ๋ Œ์น˜์— push
git push origin master

#ํŠน์ • ๋ธŒ๋ Œ์น˜์— push
git push origin {๋ธŒ๋ Œ์น˜ ์ด๋ฆ„}

 


ํ’€ (pull)

#์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ๋ธŒ๋ Œ์น˜ pull
git pull

#ํŠน์ • ๋ธŒ๋ Œ์น˜ pull
git pull origin {๋ธŒ๋ Œ์น˜ ์ด๋ฆ„}

- git pull ์—๋Ÿฌ

Your local changes to the following files would be overwritten by merge (์ถฉ๋Œ๋‚œ๊ฒƒ)

=> ํ•ด๊ฒฐ (ํŒŒ์ผ ๋˜๋Œ๋ฆฌ๊ธฐ)

git stash

 


๋ธŒ๋ Œ์น˜ (branch)

#๋ธŒ๋ Œ์น˜ ๋ชฉ๋ก
git branch

#๋ธŒ๋ Œ์น˜ ์ƒ์„ฑ/์ด๋™
git checkout -b {๋ธŒ๋ Œ์น˜ ์ด๋ฆ„}

#master๋กœ ๋Œ์•„์˜ด
git checkout master

 


Git ๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋ณ€๊ฒฝํ•˜๊ธฐ

#์—ฐ๊ฒฐ๋œ repository ๊ฒฝ๋กœ ํ™•์ธ
git remote -v

#๋ณ€๊ฒฝํ•˜๊ธฐ
git remote set-url origin {๋ณ€๊ฒฝํ•  git repository}
๋ฐ˜์‘ํ˜•