Skip to content

Instantly share code, notes, and snippets.

@BbsonLin
Last active March 23, 2021 02:50
Show Gist options
  • Save BbsonLin/07c25efbec7c4fc93fbf9befa5e2d15b to your computer and use it in GitHub Desktop.
Save BbsonLin/07c25efbec7c4fc93fbf9befa5e2d15b to your computer and use it in GitHub Desktop.

開發完成送出合併請求(Pull Request, PR)

Ref: https://www.peterdavehello.org/2014/02/update_forked_repository/
Ref: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/syncing-a-fork

第一次設定(本地新增 upstream remote)

git remote add upstream https://github.com/otheruser/repo.git
git remote -v

之後設定

git checkout master

git fetch upstream master

git rebase upstream/master

git push origin master


Code Review PR

Ref: https://docs.github.com/en/enterprise/2.15/user/articles/checking-out-pull-requests-locally

list remote refs

git ls-remote

更新(fetch) 並建立本地分支(pr-2)

git fetch origin pull/<PR#>/head:pr-<PR#>
eg. PR#2 => git fetch origin pull/2/head:pr-2

切換分支

git checkout pr-<PR#>
eg. PR#2 => git checkout pr-2

PR 更動

git pull origin pull/<PR#>/head
eg. PR#2 => git pull origin pull/2/head

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment