Practice Makes Perfect

TIL ์ฑŒ๋ฆฐ์ง€(2) GIT ์ด์Šˆ์ƒ์„ฑ ๋ฐ ํ•ด๊ฒฐํ•˜๊ธฐ - ๋ธŒ๋Ÿฐ์น˜ ์‚ฌ์šฉํ•ด๋ณด๊ธฐ!

by Hey-D

๐Ÿ“Œ ์ƒํ™ฉ ์˜ˆ์‹œ)

TIL ์ž‘์„ฑํ•˜์—ฌ git push๋กœ ์ด๋ฏธ ์˜ฌ๋ ธ์Šต๋‹ˆ๋‹ค! ๊ณต๋ถ€ํ•ด์•ผ ํ•˜๋Š” ๋‚ด์šฉ์ด ์ƒ๊ฐ๋‚˜์„œ ํ•ด๋‹น ๋‚ด์šฉ์„ ์ด์Šˆ๋กœ ์ƒ์„ฑํ•˜๊ณ  ๊ณต๋ถ€๋ฅผ ์ง„ํ–‰ํ•˜์˜€์„ ๋•Œ  ์ด์Šˆ ํ•ด๊ฒฐ์„ ํ•˜๊ณ  ์‹ถ์Šต๋‹ˆ๋‹ค!

 

์ด์Šˆ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  -> ์ด์Šˆ ์ „์šฉ ๋ธŒ๋žœ์น˜๋กœ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•ด๋ณด๊ณ  -> ๊ฒฐ๊ณผ๊ฐ€ ์„ฑ๊ณตํ•˜๋ฉด -> ๊ธฐ์กด์˜ ๋ธŒ๋žœ์น˜์™€ ๋ณ‘ํ•ฉ -> ์ด์Šˆ๋ฅผ ๋‹ซ๋Š” ์ž‘์—…์„ ์ง„ํ–‰ํ•ด๋ณด๊ธฐ๋กœ ํ•ด๋ด…์‹œ๋‹ค.

 

 

1) ์ด์Šˆ ์ƒ์„ฑํ•˜๊ธฐ

  • github ์ €์žฅ์†Œ ์ฃผ์†Œ -> issues -> New issue

์ƒˆ๋กœ์šด ์ด์Šˆ๋ฅผ ๋งŒ๋“ค์–ด ์ค๋‹ˆ๋‹ค.

 

์ด์Šˆ ๋ฒˆํ˜ธ 4๋ฒˆ์œผ๋กœ ์ƒ์„ฑ๋˜์—ˆ์Šต๋‹ˆ๋‹ค!

 

 

 

2)  git branch -b ์ด์Šˆ๋ฒˆํ˜ธ : ์ด์Šˆ๋ฒˆํ˜ธ์˜ ๋ธŒ๋žœ์น˜ ์ƒ์„ฑํ•˜๊ณ  ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ์ „ํ™˜ํ•จ

git branch -b ์ด์Šˆ๋ฒˆํ˜ธ

๋”๋ณด๊ธฐ

<<2๋ฒˆ์„ ์„ธ์„ธํžˆ ํ‘ผ๋‹ค๋ฉด>> 

๋‹จ๊ณ„1)  git branch ์ด๋ฆ„ : ์ด์Šˆ ํ•ด๊ฒฐ ๋ธŒ๋žœ์น˜์šฉ๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ž‘์—…์„ ์ง„ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

 

๐Ÿ‘‰๐Ÿป ์ฐธ๊ณ  ์—๋Ÿฌ : fatal: not a valid object name: 'master'

master branch ์—์„œ ์ตœ์ดˆ์˜ commit์„ ํ•˜์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ!

๋‹ค๋ฅธ ๋ถ„๊ธฐ๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•ด์„œ๋Š” master์—์„œ commit ํ•œ๋ฒˆ ์ง„ํ–‰ ํ›„์— ๊ฐ€๋Šฅ

 

  • git branch -m [๋ธŒ๋žœ์น˜ ์ด๋ฆ„] [๋ณ€๊ฒฝํ•  ๋ธŒ๋žœ์น˜ ์ด๋ฆ„]

๋‹จ๊ณ„2)  โญ๏ธ git checkout "๋ธŒ๋žœ์น˜ ์ด๋ฆ„"  :  ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ์ž‘์—…์„ ์ง„ํ–‰ํ•˜๊ฒ ๋‹ค.

 

3) ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ์ปค๋ฐ‹ ์ž‘์—… ์ง„ํ–‰

ํ•ด๋‹น ๋ธŒ๋žœ์น˜๋กœ ์ปค๋ฐ‹ ์ž‘์—…์„ ์ง„ํ–‰ํ•ด์ค๋‹ˆ๋‹ค.

1) git status

2) git add [FILENAME]

3) git commit

i ํด๋ฆญ : insert๋ชจ๋“œ 

[์ด์Šˆ๋ฒˆํ˜ธ] ์ด์Šˆ์ด๋ฆ„

- ํ•œ ๊ฒƒ๋“ค

- 

// esc - :wq  : ์ €์žฅํ›„ ์ข…๋ฃŒ

 

4) git push origin ์ด์Šˆ๋ฒˆํ˜ธ(๋ธŒ๋žœ์น˜ ์ด๋ฆ„)

 

 

4) Pull request ์ž‘์—… + ๋ธŒ๋žœ์น˜ ๋ณ‘ํ•ฉํ•˜๊ธฐ

์ž˜๋ด, ์ด๊ฒŒ ํ˜ผ์ž๋งŒ์˜ ์—ญํ™œ๋†€์ด๋‹ค

๋‹ด๋‹น์ž(๋‚ด์ž์‹ )๊ฐ€ ํ•ด๋‹น ๋‚ด์šฉ์„ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

 

 

Full requests ์‹œ ๋‚˜์˜ค๋Š” ํ™”๋ฉด

์—ฌ๊ธฐ์„œ ์‹ ๊ธฐํ•˜๊ฒŒ Full request๊ฐ€ issue #5๋กœ ์ƒ์„ฑ๋˜๋Š”๋ฐ์š”, ์ด ๋˜ํ•œ ํ•˜๋‚˜์˜ ์ด์Šˆ์ฒ˜๋Ÿผ ์ฒ˜๋ฆฌ๋˜๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

Files changed ๋ฅผ ๋ˆŒ๋Ÿฌ ์ˆ˜์ •ํ•œ ๋‚ด์šฉ์„ ํ™•์ธํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ด๋‹น์ž(๋‚ด์ž์‹ )๊ฐ€ ๋‚ด์šฉ์„ ํ™•์ธํ•˜๊ณ  ์ ํ•ฉํ•˜๋‹ค๊ณ  ๋Š๋‚€๋‹ค๋ฉด merge pull request๋ฅผ ๋ˆŒ๋Ÿฌ์ค๋‹ˆ๋‹ค.

 

 

 

์ด๋ ‡๊ฒŒ merge๋ฅผ ํ•˜์˜€์œผ๋ฉด, 4๋ธŒ๋žœ์น˜๋ฅผ ์‚ญ์ œํ•  ๊ฒƒ์ด๋ƒ๊ณ  ๋ฌผ์–ด๋ด…๋‹ˆ๋‹ค! ์ถ”ํ›„์— ํ•ด๋‹น ๋ธŒ๋Ÿฐ์น˜์—์„œ ์ž‘์—…ํ•  ์œ„ํ—˜์ด ์žˆ์œผ๋ฏ€๋กœ ๊น”๋”ํ•˜๊ฒŒ ์‚ญ์ œํ•ด์ค๋‹ˆ๋‹ค.

 

 

5) ์ด์Šˆ ๋‹ซ๊ธฐ

์™„๋ฃŒํ•œ ์ด์Šˆ๋Š” ์ง์ ‘ ๋‹ซ์•„์ฃผ๊ฑฐ๋‚˜, ๋ช…๋ น์–ด๋กœ ๋‹ซ์•„ ์ค„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

์ง์ ‘ ๋‹ซ๋Š” ๋ฐฉ๋ฒ•์€

-> issue์— ๋“ค์–ด๊ฐ€๊ณ  -> ํ•ด๋‹น ๋‚ด์šฉ ํ™•์ธ ํ•œ ๋ถ€๋ถ„ ์ฒดํฌ & ๋ฉ”์„ธ์ง€ ์ž…๋ ฅ -> ๋‹ซ๊ธฐ 

 

 

๋ช…๋ น์–ด๋กœ ๋‹ซ๋Š” ๋ฐฉ๋ฒ•

์•„๋ž˜์˜ ๋ฌธ์„œ๋ฅผ ์ฐธ๊ณ  ํ•˜์—ฌ commit ํ• ๋•Œ close resloves ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ซ์•„์ค๋‹ˆ๋‹ค

๊นƒ isuue ๋ช…๋ น์–ด : https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue

 

Closes #4

Resolves #10

 

๋‹จ, ์ œ๊ฐ€ ํ…Œ์ŠคํŠธ ํ•ด๋ณด์•˜์„ ๋‹น์‹œ... ๋‹ค๋ฅธ branch์—์„œ commitํ•˜์—ฌ merge์˜ ๊ฒฝ์šฐ์—๋Š” ์ €์ ˆ๋กœ ๋‹ซํžˆ์ง€ ์•Š๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

(ํ‹€๋ฆด์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค) (์ œ ๋Šฅ๋ ฅ ๋ถ€์กฑ์ผ ์ˆ˜๋„ ์žˆ์œผ๋‚˜..)

branch ๋ณ‘ํ•ฉ์ด ์•„๋‹Œ, ๊ธฐ์กด branch์—์„œ ์‚ฌ์šฉํ•  ๋•Œ ํŽธํ•˜๊ฒŒ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

 

๋งŒ์•ฝ ์„ฑ๊ณตํ–ˆ๋‹ค๋ฉด ์ด๋Ÿฐํ˜•์‹์œผ๋กœ git graph ๊ฐ€ ๋‚˜์˜ฌ ๊ฒƒ์ž…๋‹ˆ๋‹ค! => ์‚ฌ์ง„์€ ๊ณผ๊ฑฐ ์—ฐ์Šตํ–ˆ๋˜ ๊ฒƒ ์‚ฌ์šฉ

 

 

 

 

๐Ÿ“Œ ์ฐธ๊ณ  :

๊นƒ ์ฐธ๊ณ  ํ•˜๋ฉด ์ข‹์€ ์ž…๋ฌธ์„œ : https://backlog.com/git-tutorial/kr/stepup/stepup1_3.html

 

๋ˆ„๊ตฌ๋‚˜ ์‰ฝ๊ฒŒ ์ดํ•ดํ•  ์ˆ˜ ์žˆ๋Š” Git ์ž…๋ฌธ~๋ฒ„์ „ ๊ด€๋ฆฌ๋ฅผ ์™„๋ฒฝํ•˜๊ฒŒ ์ด์šฉํ•ด๋ณด์ž~ | Backlog

๋ˆ„๊ตฌ๋‚˜ ์‰ฝ๊ฒŒ ์•Œ ์ˆ˜ ์žˆ๋Š” Git์— ์ž…๋ฌธํ•˜์‹  ๊ฒƒ์„ ํ™˜์˜ํ•ฉ๋‹ˆ๋‹ค. Git์„ ์‚ฌ์šฉํ•ด ๋ฒ„์ „ ๊ด€๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•จ๊ป˜ ๊ณต๋ถ€ํ•ด๋ด…์‹œ๋‹ค!

backlog.com

https://wayhome25.github.io/git/2017/07/08/git-first-pull-request-story/

 

https://www.popit.kr/github%EB%A1%9C-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EA%B4%80%EB%A6%AC%ED%95%98%EA%B8%B0-part1-%EC%9D%B4%EC%8A%88-%EB%B0%9C%EA%B8%89-%EB%B6%80%ED%84%B0-%EC%BD%94%EB%93%9C%EB%A6%AC%EB%B7%B0%EA%B9%8C/

 

https://kyounghwan01.github.io/blog/etc/git/git-issue/#%E1%84%89%E1%85%A2%E1%84%85%E1%85%A9%E1%84%8B%E1%85%AE%E1%86%AB-%E1%84%8B%E1%85%B5%E1%84%89%E1%85%B2-%E1%84%8B%E1%85%A7%E1%86%AF%E1%84%80%E1%85%B5

 

 

์ด ๊ธ€์˜ ํƒœ๊ทธ

๋ธ”๋กœ๊ทธ์˜ ์ •๋ณด

์™„๋ฒฝ์ฃผ์˜๋ณด๋‹ค๋Š” ์™„๋ฃŒ์ฃผ์˜

Hey-D

ํ™œ๋™ํ•˜๊ธฐ