๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Git & GitHub

Github ๋ ˆํฌ์ง€ํ† ๋ฆฌ ์ปค๋ฐ‹ ์ด๋ ฅ ์œ ์ง€ํ•œ ์ฑ„ ๋‹ค๋ฅธ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ๋ณต์ œํ•˜๊ธฐ

by ์ฃผ๋ฐœ2 2022. 9. 9.
๋ฐ˜์‘ํ˜•

๐Ÿ“Ž Github ๋ ˆํฌ์ง€ํ† ๋ฆฌ ์ปค๋ฐ‹ ์ด๋ ฅ ๋ณด๊ด€ํ•œ ์ฑ„ ๋ณต์ œํ•˜๊ธฐ

๊ธฐ์กด ๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋‚ด์šฉ์„ ์ƒˆ๋กœ์šด ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ์ด๋ ฅ์„ ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜๋ฉด์„œ ๋ณต์ œ๋ฅผ ํ•ด์•ผ ํ•  ๋•Œ๊ฐ€ ์žˆ๋Š”๋ฐ์š”,

์ด ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ํ•˜๋ฉด ๊ธฐ์กด ์ด๋ ฅ์„ ์œ ์ง€ํ•œ ์ฑ„ ๋ ˆํฌ์ง€ํ† ๋ฆฌ ๋ณ€๊ฒฝ์ด ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

 

 

Design-Pattern-Study ํด๋”๊ฐ€ ๊ธฐ์กด์— ์กด์žฌํ•˜๋˜ ๋ ˆํฌ์ง€ํ† ๋ฆฌ์ด๊ณ , to ํด๋”๊ฐ€ ์ด๋™ํ•  ๋ ˆํฌ์ง€ํ† ๋ฆฌ์ž…๋‹ˆ๋‹ค.

์ฆ‰, ๊ธฐ์กด Design-Pattern-Study ๋ ˆํฌ์ง€ํ† ๋ฆฌ์˜ ์ด๋ ฅ์„ ๊ทธ๋Œ€๋กœ ๋ณด๊ด€ํ•œ ์ฑ„ to ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋กœ ์˜ฎ๊ฒจ๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

 

 

๐Ÿฅ• ์ „์ฒด ๊ณผ์ •์„ ๋ช…๋ น์–ด๋กœ ๊ฐ„๋‹จํžˆ ๋‚˜ํƒ€๋‚ด๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

// to ํด๋”๋กœ ์ด๋™
cd to

// main(master) ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ
git checkout main(master)

// ๊ธฐ์กด ๋ ˆํฌ์ง€ํ† ๋ฆฌ url ์ถ”๊ฐ€ : cloneํ•  ๋•Œ ๋ณต์‚ฌํ•œ ์ฃผ์†Œ ๋„ฃ์œผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
git remote add from <๊ธฐ์กด ๋ ˆํฌ์ง€ํ† ๋ฆฌ url>
ex) git remote add from https://github.com/YAPP-19th/Design-Pattern-Study.git

// fetch
git fetch from

// merge
git merge from/main(master) --allow-unrelated-histories

// push
git push origin

// remote ์‚ญ์ œ
git remote rm from

 

 

๐Ÿฅ• ์œ„ ๊ณผ์ •์— ๋Œ€ํ•ด ํ•˜๋‚˜์”ฉ ๊ฐ„๋žตํžˆ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

1. ๋ณต์ œ๋  ํด๋”๋กœ ์ด๋™

cd to

 

 

2. main(master) ๋ธŒ๋žœ์น˜๋กœ ๋ณ€๊ฒฝ

  • git checkout main(master)

์œ„ ์‚ฌ์ง„์„ ๋ณด์‹œ๋ฉด ํ˜„์žฌ main ๋ธŒ๋žœ์น˜์ด๋ฏ€๋กœ ๋ณ€๊ฒฝํ•  ๋‚ด์šฉ์€ ์—†์Šต๋‹ˆ๋‹ค.

(์ฐธ๊ณ ๋กœ ํ˜„์žฌ ์ƒ์„ฑํ•˜๋Š” ๋ ˆํฌ์ง€ํ† ๋ฆฌ๋Š” ๋””ํดํŠธ ๋ธŒ๋žœ์น˜๊ฐ€ main ์ž…๋‹ˆ๋‹ค. ๐Ÿคฏ)

 

 

3. ๊ธฐ์กด ๋ ˆํฌ์ง€ํ† ๋ฆฌ์˜ URL ์ถ”๊ฐ€(clone ์ฃผ์†Œ)

  • git remote add from <URL>

 

 

4. 3.์—์„œ ์ƒ์„ฑํ•œ remote๋กœ fetch

  • git fetch from

 

 

5. merge

  • git merge from/main --allow-unrelated-histories

 

 

6. push

  • git push origin

 

 

7. remote rm

  • git remote rm from

 

 

์œ„ ๋‚ด์šฉ์„ ๋”ฐ๋ผํ•˜๋ฉด ๊ธฐ์กด ์ด๋ ฅ์„ ์œ ์ง€ํ•œ ์ฑ„ ์ƒˆ๋กœ์šด ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ๋ณต์ œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜ƒ

 

 

๐Ÿ“ References

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€