๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
โœ’๏ธ GitHub & Git

[GitHub & Git] ๊นƒํ—ˆ๋ธŒ์˜ Pull Request(PR) ๊ธฐ๋Šฅ ์‚ฌ์šฉํ•˜๊ธฐ

by A Lim Han 2023. 5. 25.

๐Ÿ’Ž GitHub Pull Request(PR) ๊ธฐ๋Šฅ์ด๋ž€?

 

Repo #2๋ฅผ ์›๋ณธ Repo, ๋‚ด๊ฐ€ ์›๋ณธ ์ €์žฅ์†Œ๋ฅผ Forkํ•˜์—ฌ ๋งŒ๋“  ๋‚˜์˜ Repo๋ฅผ Repo #1์ด๋ผ๊ณ  ๊ฐ€์ •ํ•˜์ž.
์ด๋•Œ Forkํ•œ ์ €์žฅ์†Œ์—์„œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ A๊ฐ€ ๋ฐœ์ƒํ•  ๊ฒฝ์šฐ, ๊ธฐ์กด ์ €์žฅ์†Œ์˜ ๊ด€๋ฆฌ์ž์—๊ฒŒ ์ด A์˜ ๋ฐ˜์˜์„ ์š”์ฒญํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ Pull Request(PR) ์ด๋ผ๊ณ  ํ•œ๋‹ค.

 


 

๐Ÿ’Ž GitHub Pull Request(PR) ๊ธฐ๋Šฅ์˜ ์‚ฌ์šฉ๋ฒ• 

1. ์ž‘์—…ํ•  ๋ ˆํฌ์ง€ํ† ๋ฆฌ์— ๋Œ€ํ•ด fork(ํฌํฌ) ์ง„ํ–‰

 

+ ํฌํฌ(fork) ๊ธฐ๋Šฅ๊ณผ ๊ด€๋ จ๋œ ์ •๋ณด๋Š” ์•„๋ž˜ ํฌ์ŠคํŒ… ์ฐธ๊ณ 

--> https://alim11.tistory.com/336

 

[GitHub & Git] ๊นƒํ—ˆ๋ธŒ์˜ Fork(ํฌํฌ) ๊ธฐ๋Šฅ ์‚ฌ์šฉํ•˜๊ธฐ

๐Ÿ’Ž GitHub Fork (ํฌํฌ) ๊ธฐ๋Šฅ์ด๋ž€? ๊นƒํ—ˆ๋ธŒ์˜ fork(ํฌํฌ) ๊ธฐ๋Šฅ์€ ๋‹ค๋ฅธ ์‚ฌ์šฉ์ž์˜ ์ €์žฅ์†Œ(Repo #2)๋ฅผ ์ž์‹ ์˜ ๊ณ„์ •(Repo #1)์œผ๋กœ ๋ณต์ œํ•˜๋Š” ๊ธฐ๋Šฅ์ด๋‹ค. Fork๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋œ ์ €์žฅ์†Œ(Repo #1)๋Š” ์›๋ณธ ์ €์žฅ์†Œ์™€ ๋…๋ฆฝ์ ์œผ

alim11.tistory.com

 

 


 

 

2. ์•„๋ž˜์ฒ˜๋Ÿผ Fork๊ฐ€ ์™„๋ฃŒ๋˜์—ˆ๋‹ค๋ฉด, ์•„๋ž˜ ์ ˆ์ฐจ๋ฅผ ๋”ฐ๋ผ ๋กœ์ปฌ ์ €์žฅ์†Œ๋กœ Clone ์ง„ํ–‰

๋ณธ์ธ ์›๊ฒฉ ์ €์žฅ์†Œ์— ์„ฑ๊ณต์ ์œผ๋กœ ๋ณต์ œ๋œ ๋ชจ์Šต

$ cd "Clone ํ•  ๋กœ์ปฌ ํด๋” ๋งํฌ"  #1 Cloneํ•  ๋กœ์ปฌ ํด๋” ๋งํฌ๋กœ ์ด๋™
$ git clone "๋‚˜์˜ ๋ ˆํฌ์ง€ํ† ๋ฆฌ URL"  #2 ๋‚˜์˜ ๋ ˆํฌ์ง€ํ† ๋ฆฌ URL์„ ๋ณต์‚ฌ ํ›„ clone ์ง„ํ–‰

 

+ Clone ๊ธฐ๋Šฅ๊ณผ ๊ด€๋ จ๋œ ์ •๋ณด๋Š” ์•„๋ž˜ ํฌ์ŠคํŒ… ์ฐธ๊ณ 

--> https://alim11.tistory.com/340

 

[GitHub & Git] Git Clone ๊ธฐ๋Šฅ ์‚ฌ์šฉ๋ฒ•

๐ŸŒธ GitHub Clone ๊ธฐ๋Šฅ์ด๋ž€? ์›๊ฒฉ ์ €์žฅ์†Œ(๊นƒํ—ˆ๋ธŒ ์ €์žฅ์†Œ)๋ฅผ ๋กœ์ปฌ ํ™˜๊ฒฝ์œผ๋กœ ๋ณต์ œํ•˜๋Š” ๊ธฐ๋Šฅ์„ Clone ์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ์›๊ฒฉ ์ €์žฅ์†Œ์— ์žˆ๋Š” ์ฝ”๋“œ์™€ ํŒŒ์ผ์„ ๋กœ์ปฌ ์ปดํ“จํ„ฐ๋กœ ๊ฐ€์ ธ์™€ ์ž‘์—…ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ,

alim11.tistory.com

 


 

 

3. ์•„๋ž˜ ๋ช…๋ น์–ด๋“ค์„ ์ˆœ์ฐจ์ ์œผ๋กœ ์ ์šฉํ•˜์—ฌ ์›๋ณธ ์ €์žฅ์†Œ remote ์„ค์ • ์ง„ํ–‰

$ git remote add "์ €์žฅ์†Œ์˜ ๋ณ„๋ช…" "์›๋ณธ ์ €์žฅ์†Œ์˜ URL"  #1 ์›๋ณธ ์ €์žฅ์†Œ๋ฅผ ์„ค์ •ํ•œ ์ด๋ฆ„์œผ๋กœ remote

$ git remote -v  #2 ์ƒ์„ฑ๋œ ์›๊ฒฉ ์ €์žฅ์†Œ ํ™•์ธ

origin์€ ์›๋ณธ ์ €์žฅ์†Œ์ด๊ณ , testers๋Š” ๋ฐฉ๊ธˆ ์ƒ์„ฑํ•œ ๋‚˜์˜ ์ €์žฅ์†Œ์ด๋‹ค.

 

+  Remote ๋ช…๋ น์–ด์™€ ๊ด€๋ จ๋œ ์ •๋ณด๋Š” ์•„๋ž˜ ํฌ์ŠคํŒ… ์ฐธ๊ณ 

--> https://alim11.tistory.com/338

 

[GitHub & Git] Git remote ๊ด€๋ จ ๋ช…๋ น์–ด ์ •๋ฆฌ

๐Ÿ‰ Git remote ๋ช…๋ น์–ด๋ž€? Remote ๋ช…๋ น์–ด๋Š” Git(๋ถ„์‚ฐ ๋ฒ„์ „ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ)์ด ์›๊ฒฉ ์ €์žฅ์†Œ์™€์˜ ์ƒํ˜ธ ์ž‘์šฉ์„ ์œ„ํ•ด ์ œ๊ณตํ•˜๋Š” ๋ช…๋ น์–ด์˜ ์ผ์ข…์ด๋‹ค. Remote ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์›๊ฒฉ ์ €์žฅ์†Œ๋ฅผ ์ œ๊ฑฐ, ์ถ”๊ฐ€ํ•˜๊ฑฐ๋‚˜ ์ˆ˜

alim11.tistory.com

 

 


 

 

4. remote ๊ณผ์ • ํ›„ branch ์ƒ์„ฑ ์ง„ํ–‰

$ git branch "์ƒ์„ฑํ•  branch ์ด๋ฆ„"  #1 branch ์ƒ์„ฑ

$ git checkout "์กด์žฌํ•˜๋Š” branch ์ด๋ฆ„"  #2 ์กด์žฌํ•˜๋Š” branch๋กœ ์ด๋™

 

+ ์ƒ์„ฑํ•œ branch๋“ค

  • first
  • second

main branch์—์„œ first branch๋กœ ์ด๋™ ์„ฑ๊ณต

 

+  Branch์™€ ๊ด€๋ จ๋œ ์ •๋ณด๋Š” ์•„๋ž˜ ํฌ์ŠคํŒ… ์ฐธ๊ณ 

--> https://alim11.tistory.com/337

 

[GitHub & Git] Git Branch ๊ด€๋ จ ๋ช…๋ น์–ด ์ •๋ฆฌ

๐ŸŒฑ Git & GitHub์—์„œ์˜ Branch๋ž€? ๊นƒ(Git)๊ณผ ๊นƒํ—ˆ๋ธŒ(GitHub)์—์„œ์˜ branch๋ž€, ๊ฐœ๋ฐœ ์ž‘์—…์„ ๋…๋ฆฝ์ ์œผ๋กœ ์ง„ํ–‰ํ•˜๊ธฐ ์œ„ํ•ด ์ƒ์„ฑ๋˜๋Š” ๊ฐ€์ง€๋‚˜ ๋ถ„๊ธฐ๋ฅผ ์˜๋ฏธํ•œ๋‹ค. ๊ธฐ๋ณธ์ ์œผ๋กœ master (๋˜๋Š” main) ๋ธŒ๋žœ์น˜๊ฐ€ ์ƒ์„ฑ๋˜์–ด ์žˆ

alim11.tistory.com

 


 

 

5. ๋ณ€๊ฒฝ ์‚ฌํ•ญ ์ƒ์„ฑ ํ›„ ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋“ค์„ ์ˆœ์ฐจ์ ์œผ๋กœ ์‹คํ–‰ํ•˜์—ฌ Add, Commit, Push ๊นŒ์ง€ ์ง„ํ–‰

#1
$ git add .

#2
$ git commit -m "๋ณ€๊ฒฝ ์‚ฌํ•ญ์— ๋Œ€ํ•œ ์„ธ๋ถ€ ์„ค๋ช…"

#3
$ git push origin "ํ˜„์žฌ branch๋ช…"

#1 ๋ฒˆ ๊ณผ์ •
#2 ๋ฒˆ ๊ณผ์ •
#3 ๋ฒˆ ๊ณผ์ •

 

-->  ์œ„ ๊ณผ์ •๊นŒ์ง€ ์ง„ํ–‰ํ•˜๋ฉด, ๊นƒํ—ˆ๋ธŒ์— ๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ๋ฐ˜์˜๋˜์—ˆ์Œ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

branch๊ฐ€ ์„ฑ๊ณต์ ์œผ๋กœ ์ถ”๊ฐ€๋จ
๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ๋ฐ˜์˜๋จ

 

 

 


 

 

6. ์œ„ ๊ณผ์ •๊นŒ์ง€ ๋ชจ๋‘ ์ง„ํ–‰ํ•˜์˜€๋‹ค๋ฉด, ์•„๋ž˜ ์ˆœ์„œ๋Œ€๋กœ Pull Request ์ง„ํ–‰

 

'1 commit ahead' ๋ถ€๋ถ„ ํด๋ฆญ
Create pull request ํด๋ฆญ
Comment ์ž‘์„ฑ ํ›„ Create pull request ํด๋ฆญ
์›๋ณธ ์ €์žฅ์†Œ ๊ด€๋ฆฌ์ž ๊ด€์ 
Merge pull request ํด๋ฆญ
Confirm merge ํด๋ฆญ
๋ณ€๊ฒฝ ์‚ฌํ•ญ์ด ๋ฐ˜์˜๋˜์—ˆ์Œ์„ ํ™•์ธ

 

 


 

 

7. Pull Request & Merge ์ง„ํ–‰ ํ›„ ๋™๊ธฐํ™”

$ cd "Clone ํ•  ๋กœ์ปฌ ํด๋” ๋งํฌ"  #1 Cloneํ•œ ๋กœ์ปฌ ํด๋” ๋งํฌ๋กœ ์ด๋™

$ git pull origin  #2 origin remote์™€ ๋™๊ธฐํ™” ์ง„ํ–‰

$ git branch -D first #3 ์‚ฌ์šฉ์ด ๋๋‚œ branch ์‚ญ์ œ

 

+ branch ๊ฐ€ ์ •์ƒ์ ์œผ๋กœ ์‚ญ์ œ๋˜์—ˆ์Œ์„ ํ™•์ธ

 


 

< ์ฐธ๊ณ  >

https://inpa.tistory.com/entry/GIT-%E2%9A%A1%EF%B8%8F-%EA%B9%83%ED%97%99-PRPull-Request-%EB%B3%B4%EB%82%B4%EB%8A%94-%EB%B0%A9%EB%B2%95-folk-issue

 

[GIT] โšก๏ธ ๊นƒํ—™ Pull Request ๋ณด๋‚ด๋Š” ๋ฐฉ๋ฒ• - ์•Œ๊ธฐ ์‰ฝ๊ฒŒ ์ •๋ฆฌ

์ฝ”๋“œ ๊ธฐ์—ฌ ์›๋ฆฌ (Fork ์™€ Pull Request (PR)) ๋‹ค์Œ๊ณผ ๊ฐ™์ด Gildong์™€ Minji ๋ผ๋Š” ๊นƒํ—™ ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•˜์ž. ์ด๋•Œ Minji๊ฐ€ GIldong ๊ฐœ๋ฐœ์ž์˜ ํ”„๋กœ์ ํŠธ๊ฐ€ ๋งˆ์Œ์— ๋“ค์–ด, ๊ฐ™์ด ํ”„๋กœ์ ํŠธ์— ์ฐธ์—ฌํ•ด ๊ธฐ์—ฌ์ž(Contrib

inpa.tistory.com