Pull Request

References

Step 1. Fork

Upstream Repository를 자신의 GitHub 계정으로 Fork 한다.

Step 2. Clone

Fork한 Repository를 자산의 Local working directory로 Clone 한다.

$ mkdir -p $working_dir
$ cd $working_dir
$ git clone https://github.com/$user/[repository]

Upstream Repository를 Remote에 추가한다.

$ cd [repository]
$ git remote add upstream https://github.com/[upstream]/[repository]

# Confirm that your remotes make sense: 
$ git remote -v

Step 3. Create a branch

먼저 master branch를 fetch와 rebase하여 최신 상태로 유지한다.

$ cd $working_dir/[repository]
$ git fetch upstream
$ git checkout master
$ git rebase upstream/master

그리고 개발용 branch (myfeature)를 생성한다.

$ git checkout -b myfeature

Step 4. Keep your branch in sync

Branch를 fetch와 rebase하여 최신 상태로 유지한다.

# While on your myfeature branch
$ git fetch upstream
$ git rebase upstream/master

그 상태에서 code 작업을 한다.

Step 5. Commit

수정 사항을 commit 한다.

$ git commit -a -m '[commit message]'

Step 6. Push

myfeature branch의 수정 사항을 자신의 GitHub Repository에 Push한다.

git push -f origin myfeature

Step 7. Create a pull request

GitHub에서 자신의 Repository에 가면 Compare & pull request 버튼이 활성화 된 것을 볼 수 있다. 이를 눌러서 Pull Request를 생성한다.

이후 Upstream Repository의 관리자는 요청된 Pull Request를 검토하여 Merge 여부를 결정한다.

Last updated