๐Ÿš€ BE Day 40 0506

JBยท2022๋…„ 5์›” 6์ผ
0

CodeCamp BE 02

๋ชฉ๋ก ๋ณด๊ธฐ
30/30
post-thumbnail

โฌ‡๏ธ Main Note
https://docs.google.com/document/d/1fmrR4Qq6lThvvq-GApQ_vFTc6VlvXnV3QhVvZoQjvlg/edit


๐ŸŒ• Docs

Sequence Diagram : ์ˆœ์„œ๋„
โžค This is an essential thing since other co-workers are able to know which functions to use when API is requested.

ex) https://docs.google.com/spreadsheets/d/1BCdqOX4YkpPdMstuxlfGMZO4ykqKSSlMUwJ8e0K7K3w/edit#gid=0


๐ŸŒ• Gitflow WorkFlow

Developing is done in develop branch.
โžค Naming doesn't really matter, but this is conventional.

Branch is like a specified folder.

git branch
โžค View my current working branch.
git checkout -b develop
โžค Create a branch called โ€œdevelopโ€ and move to that branch.
โžค Here, develop branch is created from master branch.
โžค git checkout -b aaa => aaa branch created and moved to aaa branch.
git checkout -b qqq
git checkout master
โžค We do not add -b when moving to existing branch.

Each branches have different folders.
โžค Even if I changed something in master branch, there's nothing with develop branch.
โžค Commit should be done to save
โžค When branches change, files and folders change.

๐Ÿซง Developing in develop branch

master branch์—์„œ feature branch๋ฅผ ๋•„๋‹ค๊ณ  ํ• ๋•Œ:
์ฒ ์ˆ˜๋Š” ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก์„ ๋งŒ๋“ค๊ณ  ์˜ํฌ๋Š” ์ƒํ’ˆ๋“ฑ๋ก์„ ๋งŒ๋“ค๊ณ  ํ›ˆ์ด๋Š” ๊ฒฐ์ œํ•˜๊ธฐ ๊ธฐ๋Šฅ์„ ๋งŒ๋“ค์—ˆ๋‹ค๊ณ  ํ•˜์ž
3๋ช…์ด ํšŒ์‚ฌ์—์„œ ๊ฐ™์ด ์ผํ•˜๊ณ  ์žˆ๊ธฐ ๋•Œ๋ฌธ์— ํšŒ์‚ฌ์—๋Š” ํ•˜๋‚˜์˜ ํฐ repository๊ฐ€ ์žˆ์Œ === develop branch
์ฒ ์ˆ˜, ์˜ํฌ, ํ›ˆ์ด๋Š” ๊ฐ๊ฐ์˜ develop branch์—์„œ ์‹œ์ž‘์„ ํ•ด์„œ ์ƒˆ branch๋ฅผ ๋”ด ํ›„ ๊ฐ์ž์˜ branch์—์„œ ์ผํ•˜๋Š”๊ฑฐ์ž„
์ฒ ์ˆ˜๊ฐ€ feature-boardwrite๋ผ๋Š” branch๋ฅผ, ์˜ํฌ๋Š” feature-productwrite, ํ›ˆ์ด๋Š” feature-payment๋ฅผ ๋งŒ๋“ฆ
์˜ํฌ vscdoe์—์„œ๋Š” feature-productwrite ๋ฐ–์— ์—†์Œ ์ž๊ธฐ๊บผ๋ฐ–์— ์—†๋Š”๊ฑฐ์ž„

๊ทธ๋ž˜์„œ ๊ฐ์ž ์นœ ์ฝ”๋“œ๋ฅผ develop์— ํ•ฉ์น˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ง„ํ–‰ํ•˜๋Š”๊ฑฐ์ž„
๊ทธ๋Ÿฌ๋ฉด develop source code๊ฐ€ ์ ์  ์ปค์ ธ๊ฐ€๋Š”๊ฑฐ์ž„

[ Deploy ]
๊ทธ๋ž˜์„œ ๋‚˜์ค‘์— ์–˜๋ฅผ ๊ทธ๋งŒ ๋งŒ๋“ค๊ณ  ๋ฐฐํฌํ•˜์ž! ํ•˜๋Š”๊ฑฐ์ž„
๊ทธ๋ฆฌ๊ณ  ์ด ๋ฐฐํฌ๋Š” master branch์—์„œ ์‹คํ–‰
๊ทผ๋ฐ ๊ทธ ์ „์— release branch์— ์ด๋™์‹œ์ผœ์„œ ํ•ฉ์นจ
โ†’ ์–˜๋„ ๊ทธ๋ƒฅ ์ด๋ฆ„์ด release branch์ผ ๋ฟ์ด์ง€ ์ด๋ฆ„์€ ์•„๋ฌด๊ฑฐ๋‚˜ ํ•ด๋„ ์ƒ๊ด€์ด ์—†์Œ
โ†’ release branch๋Š” ๊ฐœ๋ฐœ์ž๋“ค ์‚ฌ์ด์—์„œ ์•”๋ฌต์ ์ธ ๋ฃฐ์ด ์กด์žฌํ•จ
*** ์—ฌ๊ธฐ์„œ๋Š” ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜์ง€ ์•Š๊ณ  ๋ฒ„๊ทธ๋งŒ ์ˆ˜์ •ํ•ด์„œ ์—…๋ฐ์ดํŠธํ•ด์•ผํ•จ
๊ทธ๋ž˜์„œ ๋”์ด์ƒ ์ตœ์ข… ๋ฒ„๊ทธ๊ฐ€ ๋‚˜์˜ค์ง€ ์•Š๊ฒŒ ๋œ๋‹ค๋ฉด master branch์— ์ด๋™์‹œ์ผœ์„œ ๊ทธ master branch๋ฅผ ๋ฐฐํฌ์‹œํ‚ค๋Š”๊ฑฐ์ž„

[ hotfixes ]
๋งŒ์•ฝ์— master branch์— ์ด๋ฏธ ๋ฐฐํฌ๊ฐ€ ๋‹ค ๋œ ํ›„์— ์น˜๋ช…์ ์ธ ๋ฒ„๊ทธ๊ฐ€ ์ƒ๊ฒผ๋‹ค๋ฉด
( ์ถœ์‹œ ๋ฒ„์ „์— ๋ฐœ์ƒํ•œ ๋ฒ„๊ทธ๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๋ธŒ๋žœ์น˜ )
Master branch์—์„œ hotfixes branch๋ฅผ ๊นŒ๋Š”๊ฑฐ์ž„
๊ทธ๋Ÿฌ๋ฉด ๊ทธ๊ฑธ ๊ฐ€์ง€๊ณ  ์น˜๋ช…์ ์ธ ๋ฒ„๊ทธ๋“ค์„ ์ˆ˜์ • ํ›„ ๋‹ค์‹œ master branch์—์„œ ์—…๋ฐ์ดํŠธ๋ฅผ ํ•˜๋Š”๊ฑฐ์ž„

์–ด๋Š ๋ธŒ๋žœ์น˜์—์„œ ์–ด๋–ค ๋ธŒ๋žœ์น˜๋ฅผ ๋•„๋Š๋ƒ๊ฐ€ ์ƒ๋‹นํžˆ ์ค‘์š”ํ•จ (์–ด๋””์„œ ๋ญ˜ ๋•„๋Š๋ƒ)
ํŒŒ์ผ๊ณผ ํด๋”๋ฅผ ๊ฐ€์ง€๊ณ ์„œ ์ƒˆ ๋ธŒ๋žœ์น˜๋ฅผ ๋”ฐ๋Š”๊ฑฐ๊ธฐ ๋•Œ๋ฌธ์ž„
์ƒˆ ๋ธŒ๋žœ์น˜๋ฅผ ๋•„๋‹ค๊ณ  ํ•ด์„œ ๋ชจ๋“  ํŒŒ์ผ์ด ๋‹ค ์ €์žฅ๋˜์–ด์žˆ๋Š”๊ฒŒ ์•„๋‹ˆ๊ธฐ ๋•Œ๋ฌธ์— ์–ด๋””์„œ ๋•„๋Š๋ƒ๊ฐ€ matters


์šฐ๋ฆฌ๊ฐ€ ํ‰์†Œ์— git push ํ• ๋•Œ => git push origin master ์˜€์Œ
git push origin feature-boardwrite
git pull ๋ฐ›์„๋• => git pull upstream develop

๐ŸŒ• Notice

์„œ๋กœ ๋…๋ฆฝ์ ์ธ ๊ธฐ๋Šฅ ๋งŒ๋“ค๊ธฐ
๋‚˜๋ˆ ์„œ ๊ฐœ๋ฐœ์„ ํ•˜๊ณ  ์žˆ์Œ (๊ฐ์ž ๊ฒŒ์‹œ๋ฌผ, ์ƒํ’ˆ, ๊ฒฐ์ œ๋ฅผ ํ•˜๋Š”์ค‘)
โ€“ ์ด๋•Œ ํ›ˆ์ด๊ฐ€ ์ฒ ์ˆ˜์˜ ์†Œ์Šค์ฝ”๋“œ๋ฅผ ๋ณ€๊ฒฝํ•˜๋ฉด ์•ˆ๋จ
ํ›ˆ์ด๋„ ๊ฒŒ์‹œ๊ธ€ ๋“ฑ๋ก์„ ์ˆ˜์ •ํ•˜๊ฒŒ ๋˜๋ฉด ๋‘๊ตฐ๋ฐ์—์„œ ๋™์‹œ์— ๋ฐ”๋€Œ๊ฒŒ ๋˜๊ธฐ ๋•Œ๋ฌธ์— PR์ด ํšŒ์‚ฌ repository์— ๋‚ ๋ผ๊ฐ”์„๋•Œ merging์„ ํ•˜๋ ค๋Š”๋ฐ ๋ญ˜ ํ•ฉ์น˜๊ณ  ๋ญ˜ ๋ฒ„๋ฆด์ง€ ๋ชจ๋ฅด๋Š”๊ฑฐ์ž„
ํŒŒ์ผ ๋‘๊ฐœ๋ฅผ ๋™์‹œ์— merge ํ•  ์ˆ˜ ์—†์Œ(X)
๊ณตํ†ต์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๊ธฐ๋Šฅ๋“ค์€ ๋ฆฌ๋”๋‚˜ ์‹œ๋‹ˆ์–ด๊ฐ€ ๋‹ด๋‹นํ•ด์•ผํ•จ (์„œ๋กœ ๋…๋ฆฝ์ ์ธ ๊ธฐ๋Šฅ์ด ์•ˆ๋ ๋•Œ )
๋ชจ๋“  ๊ตฐ๋ฐ๊ตฐ๋ฐ์— ์˜ํ–ฅ์„ ๋ฏธ์น˜๋‹ค ๋ณด๋‹ˆ, ๊ณตํ†ต ๊ธฐ๋Šฅ๋“ค์€ ๋ฆฌ๋”, ์‹œ๋‹ˆ์–ด ๋“ฑ๋“ฑ ์—ฐ์ฐจ๊ฐ€ ์žˆ๋Š” ์‚ฌ๋žŒ๋“ค์ด ๋งก์•„์„œ ์ง„ํ–‰ํ•จ
๋‹ค๋ฅธ ๊ฐœ๋ฐœ์ž๋“ค์—๊ฒŒ ํ”ผํ•ด๊ฐ€ ๋˜์ง€ ์•Š๊ฒŒ๋” ํ”ผํ•ด์—ฌ๋ถ€๋„ ์ฒดํฌํ•ด๊ฐ€๋ฉด์„œ ๊ฐœ๋ฐœํ•ด์•ผํ•จ
Merge๊ฐ€ ์•ˆ๋œ ๊ธฐ๋Šฅ๊ณผ ๋…๋ฆฝ์ ์ธ ๊ธฐ๋Šฅ ๋งŒ๋“ค๊ธฐ
์ฒ ์ˆ˜๊ฐ€ ์‹œ๊ฐ„์ด ์ข€ ๋‚จ์•„์„œ ๋‹ค์Œ๊ฑฐ๋ฅผ ๋จผ์ € ๊ฐœ๋ฐœํ•ด๋ณผ๊นŒ? ํ•˜๋Š”๋ฐ ๊ทธ๋Ÿฌ๋ฉด ๊ฒŒ์‹œ๋ฌผ ๋“ฑ๋ก ํ–ˆ์œผ๋‹ˆ๊นŒ ๊ฒŒ์‹œ๋ฌผ ์ˆ˜์ •์„ ํ•ด๋ณด์ž ์ด๋žฌ์Œ
๊ทผ๋ฐ ์ด๊ฑฐ ์œ„ํ—˜ํ•จ!! ์•„์ง ํ•ฉ์ณ์ง€์ง€ ์•Š์€ ์ƒํƒœ์—์„œ ๋ญ˜ ๋” ํ•˜๋ ค๊ณ  ํ•˜๋ฉด ์•ˆ๋จ
โ†’ Merge ๊ฐ€ ์•ˆ๋ ์ˆ˜๋„ ์žˆ๋Š”๋ฐ ๊ทธ๊ฑฐ์— ์˜์กด์ ์ธ API๋ฅผ ๋งŒ๋“ค๊ฒŒ ๋˜๋ฉด ๊ผฌ์ด๊ฒŒ ๋จ
Merge๊ฐ€ ์•ˆ๋˜๊ณ  ๊ฑฐ์ ˆ๋‹นํ–ˆ์„๋•Œ๋ฅผ ์ƒ๊ฐํ•ด๋ด์•ผํ•จ
Merge๊ฐ€ ์•ˆ๋œ ๊ธฐ๋Šฅ์— ์˜์กด์ ์ธ ๊ธฐ๋Šฅ ๋งŒ๋“ค์ง€ ๋ง๊ธฐ
[ ์‹ค์Šต ]
ํšŒ์‚ฌ repository : mentoโ€™s repository
Push ํ•˜๊ฒŒ ๋˜๋ฉด pr๋‚ ๋ฆฌ๊ณ  ํ™•์ธ ๋ˆ„๋ฅด๋ฉด ์ž๋™์œผ๋กœ ์›๋ณธ์— pull request๊ฐ€ ๋‚ ๋ผ๊ฐ€๊ฒŒ ๋จ
Pull request ์—์„œ ํšŒ์‚ฌ Repository๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์‚ฌ๋žŒ์€ merge๋ฅผ ํ•  ์ˆ˜ ์žˆ์Œ

ํŒ€์žฅ git clone ํ›„ ๊ทธ branch์— ๋“ค์–ด๊ฐ€์„œ ์ƒˆ branch ์ƒ์„ฑ
=> git checkout -b feature-#10
Api ๋งŒ๋“ค๊ณ  ์ด๊ฑฐ์ €๊ฑฐ ํ•œ ํ›„โ€ฆ
git add .
git commit -m โ€œUpdate - board apiโ€ [ Commit Convention ]
git push origin feature-#10
git log ํ•˜๋ฉด commit logs ์กฐํšŒ ๊ฐ€๋Šฅํ•ด์„œ ๋˜๋Œ๋ฆฌ๊ธฐ๊ฐ€ ๊ฐ€๋Šฅํ•จ

Git pull upstream develop
์„ ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” 1. git checkout develop
2. git add remote add upstream โ€œ์›๋ณธ์ฃผ์†Œโ€
3. git pull upstream develop

๊ทธ๋ž˜์„œ ๊ณ„์† ๊ฐœ๋ฐœ์„ ์ง„ํ–‰ํ•ด๋‚˜๊ฐ€๋Š”๊ฑฐ์ž„
git checkout -b feature-#11
โ†’ ์ด๋Ÿฐ์‹์œผ๋กœ ๋˜ ๋ธŒ๋žœ์น˜ ๋”ฐ์„œ ๋งŒ๋“ค๊ณ  ์ž‘์—…ํ•˜๊ณ  pr๋‚ ๋ฆฌ๊ณ โ€ฆ
์ด๋•Œ feature-#NUMBER์—์„œ NUMBER๋Š” issue ๋ฒˆํ˜ธ

profile
๋‘๋น„๋‘๋ฐฅ๋ฐฅ

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