본문 바로가기

Software Engineering

[git]issue, branch, PR

fork -> clone ->  issue을 올리고 -> 각자의 IDE에서 코드 작업 

 

1. git main에서 작업하지 말고 무조건 branch만들고 거기서 작업할 것

git branch pr_test
git checkout pr_test
git add PR_test.py(작업내용)
git commit -m "PR_test"
git push

# 이때 fatal: The current branch pr_test has no upstream branch.
# To push the current branch and set the remote as upstream, use
# 이런 에러가 뜨는건 로컬엔 새로운 branch가 있지만 github엔 반영이 안되었기 때문
git push --set-upstream origin pr_test
# 를 입력해주면 github에도 만든 브랜치가 생긴걸 알 수 있다

# To https://github.com/kim-seo-hyun/jecobe.git
# * [new branch]      pr_test -> pr_test
# Branch 'pr_test' set up to track remote branch 'pr_test' from 'origin'.

# push를 하고 다시 main브랜치로 돌아오는 걸 잊지 말 것!
git checkout main

위의 명령어를 끝내고 깃허브 레포에 들어가면 위 사진처럼 뜨는 걸 볼 수 있다. compate & pull request 클릭

 

위와 같은 창이 뜨면 .github/PULL_REQUEST_TEMPLATE/pull_request_template.md 에서 파일을 복사한 후 내용 작성. 이때 본인이 해결한 issue 번호를 꼭 적어주세요! 다 적고 create pull request 클릭

 

내가 merge를 승인하고 나면 이런 화면이 뜨고 delete branch를 클릭하면 자동으로 브랜치가 없어진다! 새로운 작업할땐 맨 위로 돌아가서 브랜치 다시 만들고 반복하면 된다 :)

 

'Software Engineering' 카테고리의 다른 글

[WSL] Ubuntu command  (1) 2022.09.10
[python web] Django (1)  (0) 2022.09.10
Part4. +a  (0) 2022.08.23
Part.2 HTTP  (0) 2022.08.23
Part.1 웹서버란 무엇인가  (0) 2022.08.23