[๐ŸŽ€๊นƒ & ๊นƒํ—ˆ๋ธŒ] pull-request ํ˜‘์—… ๋ฐฉ๋ฒ•

์•ˆ์ง€์ˆ˜ยท2023๋…„ 7์›” 28์ผ
0

ํ•˜๋‚˜์˜ ์›๊ฒฉ ์ €์žฅ์†Œ(๋ฉ”์ธ repo)์—์„œ ํ˜‘์—…ํ•˜๊ธฐ ์œ„ํ•ด์„œ, ๊ฐ์ž์˜ ์ง€์—ญ ์ €์žฅ์†Œ(repo)์—์„œ ์ž‘์—… ํ›„, PRํ•˜์—ฌ ์›๊ฒฉ ์ €์žฅ์†Œ์— ๊ณต์œ ํ•˜๊ณ  ํ•ฉ์น˜๋Š” ์ž‘์—…


์›๊ฒฉ ์ €์žฅ์†Œ(๋ฉ”์ธ repo)์— ์žˆ๋Š” ์ฝ”๋“œ๋“ค ์ตœ์‹  ์ƒํƒœ๋กœ ์œ ์ง€ํ•˜๋ฉฐ, ์ž์‹ ์˜ ์ง€์—ญ repo๋กœ ๊ฐ€์ ธ์™€์„œ ๋กœ์ปฌ์—์„œ ์ˆ˜์ • ํ›„, PR (pull-request) ๋ณด๋‚ด๋Š” ๊ณผ์ • ๋ฐ˜๋ณต

๐ŸŽ ๋ฆฌ์•กํŠธ git ํ˜‘์—… ํ™˜๊ฒฝ ์„ธํŒ…

1. ๋งŒ๋“ค์–ด์ง„ ์›๊ฒฉ ์ €์žฅ์†Œ ๋ ˆํฌ ๋‚ด ๋ ˆํฌ๋กœ fork ํ•ด์˜ค๊ธฐ


-> ์›๊ฒฉ ์ €์žฅ์†Œ์—์„œ fork ๋ฒ„ํŠผ์„ ๋ˆŒ๋Ÿฌ์ค€๋‹ค.

2. cmd ์ฐฝ ์—ด๊ธฐ

3. cd Desktop: ๋ฐ”ํƒ•ํ™”๋ฉด์— ํ”„๋กœ์ ํŠธ ํŒŒ์ผ ๋งŒ๋“ค๊ธฐ์œ„ํ•ด ๋ฐ”ํƒ•ํ™”๋ฉด์œผ๋กœ ์ด๋™

4. git clone "์›๊ฒฉ ์ €์žฅ์†Œ ๊นƒํ—ˆ๋ธŒ ์ฃผ์†Œ" "ํ”„๋กœ์ ํŠธ ์ด๋ฆ„": ์›๊ฒฉ ์ €์žฅ์†Œ ๋‚ด์šฉ clone ํ•ด์˜ค๊ธฐ (๋ฐ”ํƒ•ํ™”๋ฉด์— ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ)


-> "ํ”„๋กœ์ ํŠธ ์ด๋ฆ„"์œผ๋กœ ๋ฐ”ํƒ•ํ™”๋ฉด์— ํ”„๋กœ์ ํŠธ ๋งŒ๋“ค๊ณ , "์›๊ฒฉ ์ €์žฅ์†Œ ๊นƒํ—ˆ๋ธŒ ์ฃผ์†Œ"์˜ ๋‚ด์šฉ clone ํ•ด์˜ด

5. cd "ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ": ๊ทธ ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ๋กœ ์ด๋™

6. code .: vs code ํŒŒ์ผ ์—ด๊ธฐ

7. git remote add "์ด๋ฆ„" "์›๊ฒฉ ์ €์žฅ์†Œ ์ฃผ์†Œ": ์›๊ฒฉ ์ €์žฅ์†Œ remoteํ•˜๊ธฐ

8. remote -v: remote ์ž˜ ๋˜์—ˆ๋Š” ์ง€ ํ™•์ธ

9. git fetch upstream(7๋ฒˆ์˜ ์ด๋ฆ„) main(๋ธŒ๋žœ์น˜ ๋ช…), git rebase upstream/main ๋˜๋Š” git pull



-> rebase์‹œ ์œ„์™€ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋œฌ๋‹ค๋ฉด, ๋‚ด๊ฐ€ ์ž‘์—…ํ•˜๊ณ  ์žˆ๋Š” ์ƒํƒœ์—์„œ ์›๊ฒฉ ์ €์žฅ์†Œ์˜ ๋‚ด์šฉ ๊ฐ€์ ธ์™€์„œ ์ƒ๊ฒจ๋‚˜๋Š” ์˜ค๋ฅ˜์ด๋‹ค. ๋”ฐ๋ผ์„œ, ์ผ๋‹จ, ๋‚ด๊ฐ€ ์ž‘์—…ํ•˜๊ณ  ์žˆ๋Š” ๊ฒƒ์„ ์Šคํƒ์— ๋„ฃ์–ด๋†“๊ณ , ์›๊ฒฉ ์ €์žฅ์†Œ์˜ ๋‚ด์šฉ์„ ๋จผ์ € ๊ฐ€์ ธ์˜จ ๋‹ค์Œ์—, ๋‚ด๊ฐ€ ํ•˜๋˜ ์ž‘์—…์„ ๋‹ค์‹œ ๊บผ๋‚ด์˜ค๋ฉด ๋œ๋‹ค.
-> fetch์™€ rebase๋ฅผ ํ•˜๊ฑฐ๋‚˜ pull์„ ํ•ด๋„ ๋œ๋‹ค. ๋‚˜๋Š” fetch์™€ rebase๋ฅผ ์ด์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•์œผ๋กœ ํ˜‘์—…ํ•˜์˜€๋‹ค.
โœ”๏ธ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•:

  • git stash: ๋‚ด๊ฐ€ ํ•˜๋˜ ์ž‘์—… ์‚ฌ๋ผ์ง
    -> git rebase upstream/main
    -> git stash pop
    -> ์ถฉ๋Œ ํ•ด๊ฒฐ

10. git checkout -b "๋ธŒ๋žœ์น˜ ๋ช…": ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ ํ›„, ๊ทธ ๋ธŒ๋žœ์น˜๋กœ ์ด๋™

11. ๋‚ด ์ฝ”๋“œ ์ž‘์„ฑ ํ›„, ๋‚˜์˜ ๋ ˆํฌ 10์—์„œ ์ƒ์„ฑํ•œ ๋ธŒ๋žœ์น˜์— ์—…๋กœ๋“œ

-> ํŒ€์žฅ์ด๋ผ๋ฉด, npx create-react-app ํ•ด์„œ push ํ•ด๋†“๊ธฐ

  • git add .
    -> git commit -m "์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€"
    -> git push origin "10์—์„œ ์ƒ์„ฑํ•œ ๋ธŒ๋žœ์น˜ ๋ช…"

12. ๋‚˜์˜ ๋ ˆํฌ์—์„œ pull-request ํ•˜๊ธฐ

13. ํŒ€์›๋“คํ•œํ…Œ pr ๋ณด๋ƒˆ๋‹ค๊ณ  ์•Œ๋ฆฌ๊ธฐ

13.1. ํŒ€์›๋“ค์ด pr ํ–ˆ๋‹ค๊ณ  ํ•˜๋ฉด, ์›๊ฒฉ ์ €์žฅ์†Œ์˜ pull-request์˜ 'file chages'์— ์ฝ”๋“œ ๋ฆฌ๋ทฐํ•ด์ค€ ํ›„, ์•Œ๋ฆฌ๊ธฐ

14. ํŒ€์›๋“ค์ด ์ฝ”๋“œ๋ฆฌ๋ทฐ ํ•ด์ฃผ๋ฉด, ์›๊ฒฉ ์ €์žฅ์†Œ์—์„œ ํ™•์ธ ํ›„, ์›๊ฒฉ ์ €์žฅ์†Œ main์— mergeํ•˜๊ธฐ

15. 9~14 ๊ณ„์† ๋ฐ˜๋ณตํ•˜๊ธฐ!!!!


๐Ÿ˜€ repo ์ƒ์„ฑ ๋ฐฉ๋ฒ•

1. repository ์ƒ์„ฑ

2. ๊ณต๋™ ์ž‘์—…์ž ์ถ”๊ฐ€ํ•˜๊ธฐ


: ํ•ด๋‹น repo๋กœ ๋“ค์–ด๊ฐ€์„œ, Settings -> Manage access -> Invite a collaborator

: username์ด๋‚˜ email๋“ฑ์„ ์ด์šฉํ•˜์—ฌ ์ดˆ๋Œ€ 9์ดˆ๋Œ€๋ฐ›์€ ํŒ€์›๋“ค์€ ๋ฉ”์ผ์ด๋‚˜ ๊นƒํ—ˆ๋ธŒ ๋ฉ”์‹œ์ง€ ํ™”๋ฉด์—์„œ ํ™•์ธํ•˜์—ฌ accept ๋ˆ„๋ฅด๋ฉด ๋จ)

3. ์œ„์˜ ํ˜‘์—… ์„ธํŒ… ๊ณผ์ • ๋˜‘๊ฐ™์ด ๋”ฐ๋ผํ•˜๊ณ , CRAํ•ด์„œ pushํ•ด์„œ ๊ธฐ๋ณธ ๋ฆฌ์•กํŠธ ์„ธํŒ…ํ•ด๋†“๊ธฐ


๐Ÿ˜€ ํŒ€์› ๊ฐ„ ์ฝ”๋“œ ๋ฆฌ๋ทฐํ•˜๊ธฐ

  • ๊ฐ ํŒ€์›์ด PR ํ•œ ๊ฒƒ์€ ์›๊ฒฉ ์ €์žฅ์†Œ(๋ฉ”์ธ repo)์—์„œ ํ™•์ธ ๊ฐ€๋Šฅ
  • ๊ณต๋™ ์ž‘์—…์ž ๋ˆ„๊ตฌ๋‚˜ merge ๊ฐ€๋Šฅ
  • ๊นƒํ—ˆ๋ธŒ ํ˜‘์—… ์‹œ, ๋ณ€๊ฒฝ ๋‚ด์šฉ์„ ๋ฐ”๋กœ ๋ฐ˜์˜ํ•˜๊ธฐ ์œ„ํ•ด ํ•ญ์ƒ pull์„ ๋จผ์ € ๋‹น๊ธดํ›„์— ์ž์‹ ์˜ ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๋Š” ๊ฒƒ์„ ๊ถŒ์žฅ
  • merge๋Š” ๋ชจ๋“  ํŒ€์›๋“ค์ด ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ๋ณดํ†ต ๋ณธ์ธ์ด ์ฑ…์ž„์ง„๋‹ค๋Š” ๋งˆ์ธ๋“œ๋กœ PR์„ ์˜ฌ๋ฆฐ ๋ณธ์ธ์ด Merge
  1. PR ์‚ดํŽด๋ณธ ํ›„, ์ด์ƒ์ด ์—†์œผ๋ฉด mergeํ•˜๊ธฐ (confirm merge)
  2. ๋ธŒ๋žœ์น˜ ๋ณ‘ํ•ฉ๋˜๋ฉด, master ๋ธŒ๋žœ์น˜์— ๋ชจ๋‘ ๋‚˜ํƒ€๋‚จ

    : files change์—์„œ ์ฝ”๋“œ๋ฆฌ๋ทฐ ๋‚จ๊ฒจ์ค€๋‹ค.

    -> ์ฝ”๋“œ๋ฆฌ๋ทฐ ์™„๋ฃŒ ํ›„ ์ฒดํฌํ‘œ์‹œ๊ฐ€ ๋œฌ๋‹ค.

    -> merge ์™„๋ฃŒ

๐ŸŽ ์ฝ”๋“œ ๋ฆฌ๋ทฐ ํƒœ๊ทธ

1. LGTM

: Looks Good To Me
-> ์ฝ”๋“œ์— ๋ณ„ ๋ฌธ์ œ๊ฐ€ ์—†๋‹ค.

2. AFAIK

: as far as I know
-> ๋‚ด๊ฐ€ ์•Œ๊ธฐ์—๋Š”, ๋‚ด๊ฐ€ ๊ธฐ์–ตํ•˜๋Š” ํ•œ

3. IMO

: in my opinion
-> ๋‚ด ์ƒ๊ฐ์—๋Š”

4. IMHO

: in my humble opinion
-> ์ œ ๊ฒฌํ•ด์—๋Š” ์š” (IMO๋ณด๋‹ค ์กฐ๊ธˆ ๋” ๊ฒฉ์‹ ์žˆ๋Š” ํ‘œํ˜„)

5. SGTM

: Sounds Good to Me
-> ์ข‹๋‹ค. 1๋ฒˆ์ด๋ž‘ ๊ฐ™์€ ๋œป

6. PTAL

: Please Take Another Look
-> ์ œ๋ฐœ ์ข€ ๋ด์ฃผ์„ธ์š”. ๋ฆฌ๋ทฐ์–ด๊ฐ€ ๋ฆฌ๋ทฐ๋ฅผ ํ•ด์ฃผ๋‹ค๊ฐ€ ์ค‘๊ฐ„์— stop๋œ ์ƒํƒœ์—์„œ ๋ฆฌ๋ทฐ์ข€ ํ•ด๋‹ฌ๋ผ๊ณ  ๋ถ€ํƒํ• ๋•Œ ์“ฐ๋Š” ๊ฒƒ

7. FYI

: For Your Information
-> ์ฐธ๊ณ ๋กœ

8. ASAP

: as soon as possible
-> ๊ฐ€๋Šฅํ•œ ๋นจ๋ฆฌ, ์ตœ๋Œ€ํ•œ ๋น ๋ฅด๊ฒŒ

9. IOW

: In Other Words
-> ๋‹ค๋ฅธ ํ‘œํ˜„์œผ๋กœ, ๋‹ค์‹œ ๋งํ•˜๋ฉด, ๋ฐ”๊พธ์–ด ๋งํ•˜๋ฉด

10. TL;DR

: Too Long. Didn't Read
-> ๋ณดํ†ต ๋ฌธ์žฅ ์•ž์— ๊ธด ๊ธ€์„ ์š”์•ฝํ•  ๋•Œ


๐Ÿ˜€ fork ์—†์ด ํ˜‘์—…ํ•˜๊ธฐ

: ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ => ์ž‘์—… => PR => ์ฝ”๋“œ ๋ฆฌ๋ทฐ => merge

1. repository ์ƒ์„ฑ

2. git clone์œผ๋กœ ๋ชจ๋“  ํŒ€์›๋“ค์ด ๋ณธ์ธ ๋กœ์ปฌ์— ํ”„๋กœ์ ํŠธ ๋ณต์ œ



vs code: ์ปดํ“จํ„ฐ์— ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ ํ›„, ์›๊ฒฉ ์ €์žฅ์†Œ ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ•˜์—ฌ, F1 ์„ ๋ˆ„๋ฅด๊ณ  git clone์„ ์ž‘์„ฑํ•œ ํ›„ url ๋ถ™์—ฌ๋„ฃ๊ธฐ

3. ๊ฐ™์€ ๋ ˆํฌ์— ์ƒˆ๋กœ์šด ๋ธŒ๋žœ์น˜ ์ƒ์„ฑ


: ๋ณดํ†ต main ๋ธŒ๋žœ์น˜์—์„œ ์ƒˆ๋กœ์šด ๋ธŒ๋žœ์น˜๋ฅผ ๋”ฐ๊ณ , ์—ฌ๊ธฐ์„œ ์ž‘์—…ํ•œ ํ›„ Pull Request(์ดํ•˜ PR)๋ฅผ ๋‚ ๋ ค ์ฝ”๋“œ๋ฆฌ๋ทฐ ํ›„ merge
-> ๋ฉ”์ธ์ด ๊ณ„์† ๋ฐ”๋€Œ๋ฉด ๋‹ค๋ฅธ ์ž‘์—…์ž๋Š” ์›๊ฒฉ๊ณผ ๋‹ค๋ฅธ ํ™˜๊ฒฝ์—์„œ ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•˜๊ฒŒ ๋˜์–ด ์ˆ˜ ๋งŽ์€ ์ถฉ๋Œ์„ ๋งž๊ฒŒ ๋  ๊ฒƒ ์ด๋ฉฐ
์—„์ฒญ๋‚œ ๋น„ํšจ์œจ

4. git pull

: ๋ณ€๊ฒฝ ์‚ฌํ•ญ ๊ฐ€์ ธ์˜ค๊ธฐ (์ฒซ commit ์•„๋‹ˆ๋ผ๋ฉด)

5. 3์˜ ๋ธŒ๋žœ์น˜์— ์ฝ”๋“œ ์ˆ˜์ • ํ›„ add, commit, push ํ•˜๊ธฐ



-> ๊ทธ๋Ÿฌ๋ฉด, ์ƒˆ๋กœ์šด ๋ธŒ๋žœ์น˜๊ฐ€ ์ƒ์„ฑ๋˜๊ณ , ๊ทธ๊ณณ์— ์ˆ˜์ •๋œ ๋‚ด์šฉ์ด ๋ฐ˜์˜๋œ๋‹ค.

6. pull-request


-> ํ•ด๋‹น ๋ธŒ๋žœ์น˜ ์ด๋ฆ„์„ ๋ˆ„๋ฅด๋ฉด, pull-request ํ•˜๊ฒ ๋ƒ๋Š” ๋ฉ”์‹œ์ง€

: ์œ„์— base์— ์›ํ•˜๋Š” ๋ธŒ๋žœ์น˜๊ฐ€ ๋„ฃ์–ด์ ธ ์žˆ๋Š”์ง€ ํ™•์ธํ•œ ํ›„, ์˜ค๋ฅธ์ชฝ์— ํŒ€์›์„ ๋ฆฌ๋ทฐ์–ด๋กœ ์„ ์ •ํ•˜๊ณ , ์ •์„ฑ์Šค๋Ÿฝ๊ฒŒ PR์„ ์ž‘์„ฑํ•˜๊ณ , Create pull request

-> ๊ทธ๋Ÿผ ์ด์™€ ๊ฐ™์€ ํ™”๋ฉด
-> PR ๋‚ ๋ฆฐ ํ›„, ๋‹ค๋ฅธ ํŒ€์›๋“ค์—๊ฒŒ ์ฝ”๋“œ ๋ฆฌ๋ทฐ ์š”์ฒญํ•˜๊ธฐ

------- ๋˜ ๋‹ค๋ฅธ ํŒ€์›์€ ------

๋‹ค๋ฅธ ํŒ€์›์˜ ์ฝ”๋“œ ๋ฆฌ๋ทฐ


: Files changed๋กœ ๊ฐ€์„œ ๋ฆฌ๋ทฐ๋ฅผ ํ•ด์ฃผ๊ณ 

: ๋ชจ๋“  ๋ฆฌ๋ทฐ๋ฅผ ๋๋ƒˆ๋‹ค๋ฉด ์šฐ์ธก ์ƒ๋‹จ์— Finish your review๋ฅผ ๋ˆ„๋ฅด๊ณ  Approve๋ฅผ ๋ˆ„๋ฅด๊ณ  Submit review๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋ฆฌ๋ทฐ ์™„๋ฃŒ
---------------- ๋‹ค์‹œ ๋‚˜๋Š” ------

7. ์ฝ”๋“œ ๋ฆฌ๋ทฐ ํ™•์ธ๊ณผ MERGE


-> Reviewers์˜ ๋ฆฌ๋ทฐ๊ฐ€ ๋๋‚˜๋ฉด(Approve๊ฐ€ ๋˜๋ฉด) ์˜ค๋ฅธ์ชฝ ์ƒ๋‹จ์ฒ˜๋Ÿผ ์ฒดํฌํ‘œ์‹œ
-> (merge๋Š” ๋ชจ๋“  ํŒ€์›๋“ค์ด ํ•  ์ˆ˜ ์žˆ์ง€๋งŒ, ๋ณดํ†ต ๋ณธ์ธ์ด ์ฑ…์ž„์ง„๋‹ค๋Š” ๋งˆ์ธ๋“œ๋กœ PR์„ ์˜ฌ๋ฆฐ ๋ณธ์ธ์ด Mergeํ•œ๋‹ค.)

-> merge ์ดํ›„ ๋‹ค๋ฅธ ํŒ€์›๋“ค์—๊ฒŒ pull ์š”์ฒญ

8. MERGE ํ™•์ธ

: ๋ฉ”์ธ ๋ธŒ๋žœ์น˜์—์„œ ๋ณ€๊ฒฝ ์‚ฌํ•ญ ํ™•์ธ ๊ฐ€๋Šฅ

โœ”๏ธ ์ •๋ฆฌ:
ํ•˜๋‚˜์˜ ์›๊ฒฉ ์ €์žฅ์†Œ์— ํ˜‘์—…์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํŒ€์›๋“ค์ด ๋ชจ๋‘ ๋ฉ”์ธ ์›๊ฒฉ ์ €์žฅ์†Œ๋ฅผ fork ํ•ด์˜ค๊ณ , pull๋กœ ๋ณ€๊ฒฝ ๋‚ด์šฉ ๋‹น๊ฒจ์˜จ ์ดํ›„, ๊ฐ์ž ๋กœ์ปฌ์— ๋ธŒ๋žœ์น˜ ์ƒˆ๋กœ ํŒŒ์„œ ์ฝ”๋“œ ์ˆ˜์ • ํ›„, ๊ฐ์ž์˜ ๋กœ์ปฌ์—์„œ add, commit, push ์ดํ›„, remote๋กœ ์—ฐ๊ฒฐ๋œ ์›๊ฒฉ ์ €์žฅ์†Œ์— PR์„ ๋ณด๋‚ธ๋‹ค. ๊ทธ๋Ÿผ ๋‹ค๋ฅธ ํŒ€์›๋“ค์€ ์ด๋ฅผ ํ™•์ธํ•˜์—ฌ code review๋ฅผ ๋‚จ๊ฒจ์ฃผ๊ณ , ๊ทธ์— ๋”ฐ๋ผ merge๋ฅผ ํ•ด์ค€๋‹ค.


์ฐธ๊ณ 

profile
์ง€์ˆ˜์˜ ์ทจ์ค€, ๊ฐœ๋ฐœ์ผ๊ธฐ

1๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2023๋…„ 7์›” 28์ผ

์ด๋Ÿฐ ์œ ์šฉํ•œ ์ •๋ณด๋ฅผ ๋‚˜๋ˆ ์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค.

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ