-
Notifications
You must be signed in to change notification settings - Fork 2
Background
Hyungoo Kang edited this page Jul 18, 2022
·
2 revisions
-
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
### Link
${problem.link}
- upstream: https://github.com/oognuyh/algorithm-study
- origin: https://github.com/${github.username}/algorithm-study
- local: your computer directory
- upstream을 fork하여 내 저장소에 추가한다.
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 명령어 사용 가능
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할 것
git pull upstream master
- Pull Request를 생성하기 전에 최신 상태로 만듦
- Github를 통해 origin의 ${issue.name} branch를 Pull 해달라고 upstream에 요청을 보낸다.
- PR 생성 시 Reviewers 선택
- 코드 리뷰 후 승인이 되면 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! 를 순서대로 입력하면 해당 커밋 메세지로 저장되고 진행됨
- 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부터 다시 시작
더 효율적이고 좋은 방법이 있다면 알려주세요:)