抓取 pull request 到 local 測試

心得:跟 Gitlab 相比,Github 方便多了。

Github 指令

1
2
3
git fetch origin pull/<pull req ID>/head:<branch name>
git checkout <branch name>

大致上就是這樣子

更新 pull request branch

1
git pull origin pull/<pull req ID>/head --no-ff

Gitlab 指令

出處:http://doc.gitlab.com/ce/workflow/merge_requests.html

  1. 打開 .git/config

    1
    2
    3
    [remote "origin"]
    url = https://gitlab.com/gitlab-org/gitlab-ce.git
    fetch = +refs/heads/*:refs/remotes/origin/*
  2. 加入 fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*

    1
    2
    3
    4
    [remote "origin"]
    url = https://gitlab.com/gitlab-org/gitlab-ce.git
    fetch = +refs/heads/*:refs/remotes/origin/*
    fetch = +refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*
  3. git fetch origin

  4. git checkout <branchname>