mingg IT

[Git] Git Pull Request 사용법 본문

git

[Git] Git Pull Request 사용법

mingg123 2021. 9. 24. 12:03

오픈소스를 수정하다보면 PR을 받아야 할 경우가 있다.

 

두번째로 하는건데 또 까먹어서 내가 작성하려고 한다. 

 

1. Fork 

 

우측 상단에 Fork를 클릭한다.

 

그렇게 되면 내 로컬에 fork했던 부분이 생기게 된다. 

 

 

2. Clone 

 

 

저 Clone 부분을 복사해서

 

git clone 어쩌고 저쩌고~! 

 

 

3. 브랜치 생성

 

내 로컬에 브랜치를 생성한다. (내가 수정하고 반영할 브랜치이다.) 

 

$ git checkout -b feature/refactorTibero

$ git pull 

pull 을받으면 remote 브랜치를 정하라고 나온다.

 

$ git branch --set-upstream-to=origin/feature/tibero feature/refactorTibero 

나는 feature/tibero 브랜치를 remote브랜치로 설정했다.

 

이후 types.d.ts 파일을 수정했다.

 

 

 

4. git add, commit, push

파일을 수정하고 커밋하고 push 한다. 이때 나의 로컬 브랜치인 feature/refactorTibero 브랜치에 push 한다. 

 

push가 성공했다.

 

 

5. Pull Request 설정

 

push를 하고나면 Compare & pull request 초록색 버튼을 볼 수 있다. 

 

 

버튼을 클릭하여 작성한 이후 적용을 누르게 되면

Pull request에 내가 수정한 부분이 등록되어 있는걸 볼 수 있다.

 

 

 

이제 해당 브랜치 관리자가 확인해서 merge하면 내가 수정한 코드가 오픈소스에 반영 되는 것이다. 

 

추가++)

push 하려고 하니 403 에러가 발생했다. 

 

해결법)

remote 브랜치를 수정한다. 

git remote set-url origin https://github.com/mingg123/node-sql-parser-tibero.git

 

GitHub - mingg123/node-sql-parser-tibero: Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableL

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL - GitHub - mingg123/node-sql-parser-tibero: Parse simple SQL statements into an ...

github.com

 

pull 한번 받고, git push origin +브랜치명 입력하고 나니 정상 작동햇음. 

Comments