Background - oognuyh/algorithm-study GitHub Wiki
How to share problems to solve
-
Click issue tab
-
Click New Issue
-
Click Get started next to the type of New problem issue
-
Type a title and link
- Title should be as follows
${Algorithm Site + problem.no}
- Alogrithm Sites
- Baekjoon Online Judge(BOJ)
- Programmers(P)
- SW Expert Academy(SEA)
- LeetCode(LC)
- e.g. BOJ2480, LC1204, P1235645, SEA1044
- Link should be as follows
-
Select todo label
-
Click Submit new issue
Title
Link
### Link
${problem.link}
How to submit
Prerequisite
- upstream: https://github.com/oognuyh/algorithm-study
- origin: https://github.com/${github.username}/algorithm-study
- local: your computer directory
Fork
- upstream์ forkํ์ฌ ๋ด ์ ์ฅ์์ ์ถ๊ฐํ๋ค.
Clone
git clone https://github.com/${github.username}/algorithm-study.git
- origin์ local๋ก ๊ฐ์ ธ์จ๋ค.
git remote -v
- ์ฐ๊ฒฐ ์ํ ํ์ธ
- origin ๋ฐ upstream์ด ์ ์ค์ ๋์ด ์๋์ง ํ์ธ
git remote add upstream https://github.com/oognuyh/algorithm-study.git
- upstream ์ถ๊ฐ
git pull upstream master
- upstream์ master branch๋ฅผ ๊ฐ์ ธ์์ ๋ณํฉ
- pull ๋์ fetch & merge ๋ช ๋ น์ด ์ฌ์ฉ ๊ฐ๋ฅ
Push
git checkout -b ${issue.name}
- local ์ ์ฅ์์ ${issue.name}์ด๋ผ๋ branch๋ฅผ ์์ฑํ๊ณ master์์ switchํ๋ค.
git add ./${issue.name}/${github.username}.${file.extension}
git commit -m "solve ${issue.name} (#${issue.no})"
git push origin ${issue.name}
- ํ์ผ๋ช ์ ${github.username}.${file.extension}์ผ๋ก ํ ๊ฒ
- ํ์ผ์ ${issue.name} ํด๋ ์๋์ ์์นํ ๊ฒ(e.g. BOJ2480/oognuyh.kt)
- ์ฝ๋ ๋ด package ๊ฒฝ๋ก๋ ํ๋ก์ ํธ ๋ด ๊ฒฝ๋ก์ ๋์ผ (e.g. package BOJ2480;)
- java์ ๊ฒฝ์ฐ ํด๋์ค ๋ช ์ ${github.username}์ผ๋ก ๋ณ๊ฒฝํ ๊ฒ(e.g. class ${github.username} { ... ))
- ${issue.name} ๋ฌธ์ ๋ฅผ ํ๊ณ ์ปค๋ฐ ์์์ ๋ง๊ฒ ์์ฑ ํ origin์ ${issue.name} branch๋ก push
- ํด๋น ํ์ผ๋ง pushํ ๊ฒ
Pull Request
git pull upstream master
- Pull Request๋ฅผ ์์ฑํ๊ธฐ ์ ์ ์ต์ ์ํ๋ก ๋ง๋ฆ
- Github๋ฅผ ํตํด origin์ ${issue.name} branch๋ฅผ Pull ํด๋ฌ๋ผ๊ณ upstream์ ์์ฒญ์ ๋ณด๋ธ๋ค.
- PR ์์ฑ ์ Reviewers ์ ํ
Code Review
- ์ฝ๋ ๋ฆฌ๋ทฐ ํ ์น์ธ์ด ๋๋ฉด upstream์ master branch์ ๋ณํฉ๋จ
- ์ฝ๋ ๋ฆฌ๋ทฐ ํ ํ์ผ ์์ ์ด ํ์ํ ๊ฒฝ์ฐ
git add ${changedFile(s)}
- ์์ ์ด ๋๋๋ฉด ์์ ๋ ํ์ผ ์คํ ์ด์ง
git commit -m "fix ${issue.name} (#${issue.no})
git push origin ${issue.name}
-
์ปค๋ฐ ํ PR์ ์์ฒญํ๋ branch์ pushํ๋ฉด ์์์ ๋ฐ์๋จ
-
๋ง์ฝ, ์คํ ๋ฑ ์ค์๋ก ์ด์ ์ปค๋ฐ์ ๋ฎ์ด์์ฐ๊ณ ์ถ์ ๊ฒฝ์ฐ๋ ์๋์ ๋ช ๋ น์ด๋ฅผ ๋ฐ๋ฆ
git commit --amend git push -f origin ${issue.name}
- ์ด์ ์ปค๋ฐ์ด push๊ฐ ๋์ด์๊ธฐ ๋๋ฌธ์ ๊ฐ์ ๋ก branch์ pushํจ
- push ํ ์๋ํฐ๊ฐ ๋์ค๋๋ฐ ESC -> : -> wq! ๋ฅผ ์์๋๋ก ์ ๋ ฅํ๋ฉด ํด๋น ์ปค๋ฐ ๋ฉ์ธ์ง๋ก ์ ์ฅ๋๊ณ ์งํ๋จ
Merge
- upstream ์ ์ฅ์์ master branch์ ์ฝ๋๊ฐ ๋ณํฉ ํ
git checkout master
- local ์ ์ฅ์ master branch๋ก switch
git branch -D ${issue.name}
- ํด๋น ๋ฌธ์ ๋ฅผ ํ์๋ local ์ ์ฅ์์ branch ์ญ์
git push origin --delete ${issue.name}
- ํด๋น ๋ฌธ์ ๋ฅผ ํ์๋ origin ์ ์ฅ์์ branch ์ญ์
git pull upstream master
git push origin master
- local ๋ฐ origin ์ ์ฅ์ ์ต์ ํ
- ์๋ก์ด ๋ฌธ์ ์ฌ๋ผ์ค๋ฉด Push Step๋ถํฐ ๋ค์ ์์