Skip to content

Instantly share code, notes, and snippets.

@asika32764
Last active June 12, 2017 08:36
Show Gist options
  • Save asika32764/5824bc66a6756dc3031e to your computer and use it in GitHub Desktop.
Save asika32764/5824bc66a6756dc3031e to your computer and use it in GitHub Desktop.
An easy way to help you get single Pull-Request from GitHub
#!/usr/bin/env bash
git fetch $1 refs/pull/$2/head:pr-$2

Getting Started

Download this file.

$ wget https://gist.githubusercontent.com/asika32764/5824bc66a6756dc3031e/raw/92f072b3c1737553bf08be2fa9695c094e607ae6/get-pr

Then mv to /usr/local/bin (Windows should put in a folder which in Environment Variable Path, I'm used to put in C:\bin)

$ chmod +x get-pr
$ mv get-pr /usr/local/bin/get-pr

cd to your git project

Then execute:

$ get-pr upstream 123
$ checkout pr-123

OK we will pull and checkout to this PR.

Usage:

$ get-pr {remote-name} {PR-ID}

It is convenience to review PR or contribute to others PR.

Image

img

Getting Started

下載此檔案

$ wget https://gist.githubusercontent.com/asika32764/5824bc66a6756dc3031e/raw/92f072b3c1737553bf08be2fa9695c094e607ae6/get-pr

接著 mv 至 /usr/local/bin (Windows 要自行放在環境變數支援的目錄,我習慣放在 C:\bin)

$ chmod +x get-pr
$ mv get-pr /usr/local/bin/get-pr

cd 至 git 專案目錄

接著執行:

$ get-pr upstream 123
$ checkout pr-123

就能拉下並 checkout 至指定 PR

Usage:

$ get-pr {remote-name} {PR-ID}

無論要 review 還是替另一個人寫 PR 都很方便

圖例

img

@ad-m
Copy link

ad-m commented Dec 30, 2015

KISS:

git config --global alias.get-pr '!f() { git fetch $1 refs/pull/$2/head:pr-$2; }; f'

@asika32764
Copy link
Author

👍

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