Git

[GitHub] ์›๊ฒฉ ์ €์žฅ์†Œ, ๋กœ์ปฌ ์ €์žฅ์†Œ, remote, push, clone, pull

ํƒฑ์ ค 2021. 3. 4. 13:43

1 . git clone ๋ช…๋ น์–ด๋กœ ๋กœ์ปฌ ์ €์žฅ์†Œ ์ƒ์„ฑํ•˜๊ธฐ

git clone [๋‚ด ์›๊ฒฉ ์ €์žฅ์†Œ url]
  • master ๋ธŒ๋žœ์น˜ ํด๋ก 
git clone -b [๋ธŒ๋žœ์น˜๋ช…] [์›๊ฒฉ ์ €์žฅ์†Œ url]
  • ํŠน์ • ๋ธŒ๋žœ์น˜ ํด๋ก 

2. git remote ๋ช…๋ น์–ด๋กœ ์›๊ฒฉ ์ €์žฅ์†Œ, ๋กœ์ปฌ ์ €์žฅ์†Œ ์—ฐ๊ฒฐํ•˜๊ธฐ

git remote 
  • ์—ฐ๊ฒฐ๋œ ์›๊ฒฉ(remote) ์ €์žฅ์†Œ ์—†์œผ๋ฉด ์•„๋ฌด๊ฒƒ๋„ ์ถœ๋ ฅ X
git remote add origin [์›๊ฒฉ ์ €์žฅ์†Œ url]
  • ์›๊ฒฉ ์ €์žฅ์†Œ ์—ฐ๊ฒฐ
git remote show [์›๊ฒฉ ์ €์žฅ์†Œ ์ด๋ฆ„]
  • ์›๊ฒฉ ์ €์žฅ์†Œ ์„ธ๋ถ€ ์ •๋ณด ๋ณด๊ธฐ

3. git push ๋กœ์ปฌ ์ €์žฅ์†Œ์— ๋ณ€๊ฒฝ๋œ ํŒŒ์ผ๋“ค์„ ์›๊ฒฉ ์ €์žฅ์†Œ์— ์˜ฌ๋ฆฌ๊ธฐ

git add . # ๋ณ€๊ฒฝ๋œ ๋ชจ๋“  ํŒŒ์ผ ์ถ”๊ฐ€
git commit -m "์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€"
git push origin master # ๋งˆ์Šคํ„ฐ ๋ธŒ๋žœ์น˜์— ํ‘ธ์‰ฌ, origin [๋ธŒ๋žœ์น˜๋ช…]์œผ๋กœ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์— ํ‘ธ์‰ฌ ๊ฐ€๋Šฅ

# ์œ„์˜ ๋‘๊ฐœ ๋ช…๋ น์–ด ํ•ฉ์นœ ๋ช…๋ น์–ด
git commit -a -m "์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€"
git push origin master # ๋งˆ์Šคํ„ฐ ๋ธŒ๋žœ์น˜์— ํ‘ธ์‰ฌ, origin [๋ธŒ๋žœ์น˜๋ช…]์œผ๋กœ ๋‹ค๋ฅธ ๋ธŒ๋žœ์น˜์— ํ‘ธ์‰ฌ ๊ฐ€๋Šฅ

4. git pull๋กœ ์›๊ฒฉ ์ €์žฅ์†Œ ํŒŒ์ผ ๊ฐ€์ ธ์˜ค๊ธฐ

git pull origin [๋ธŒ๋žœ์น˜๋ช…]
  • git fetch + git merge์™€ ๊ฐ™์Œ

ํ˜‘์—… ์‹œ push ํ•  ๋•Œ ์ฃผ์˜์  → ๋กœ์ปฌ ์ €์žฅ์†Œ๊ฐ€ ์›๊ฒฉ ์ €์žฅ์†Œ์˜ ์ตœ์‹  ๋ฒ„์ „์„ ์œ ์ง€ํ•ด์•ผํ•จ


์ฐธ๊ณ : victorydntmd.tistory.com/74?category=682764

728x90