Skip to content

Instantly share code, notes, and snippets.

@mapix
Forked from piscisaureus/pr.md
Last active December 16, 2015 05:49
Show Gist options
  • Save mapix/5386862 to your computer and use it in GitHub Desktop.
Save mapix/5386862 to your computer and use it in GitHub Desktop.

Revisions

  1. mapix revised this gist Apr 17, 2013. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions pr.md
    Original file line number Diff line number Diff line change
    @@ -45,4 +45,9 @@ git checkout FETCH_HEAD
    or:
    ```
    git fetch origin pull/7324/head:pr-7324
    ```

    prune old prs
    ```
    git remote prune origin
    ```
  2. mapix revised this gist Apr 17, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions pr.md
    Original file line number Diff line number Diff line change
    @@ -40,5 +40,9 @@ To check out a particular pull request without fetch others:
    ```
    git fetch origin refs/pull/<PRN>/head
    git checkout FETCH_HEAD
    ```

    or:
    ```
    git fetch origin pull/7324/head:pr-7324
    ```
  3. mapix revised this gist Apr 17, 2013. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions pr.md
    Original file line number Diff line number Diff line change
    @@ -35,3 +35,10 @@ Branch pr/999 set up to track remote branch pr/999 from origin.
    Switched to a new branch 'pr/999'
    ```

    To check out a particular pull request without fetch others:

    ```
    git fetch origin refs/pull/<PRN>/head
    git checkout FETCH_HEAD
    ```
  4. @piscisaureus piscisaureus revised this gist Aug 13, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion pr.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this se
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:joyent/node.git
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*```
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
    ```

    Now fetch all the pull requests:
  5. @piscisaureus piscisaureus revised this gist Aug 13, 2012. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions pr.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    Locate the section for your github remote in the `.git/config` file. It looks like this:

    ```
    @@ -32,8 +31,7 @@ To check out a particular pull request:

    ```
    $ git checkout pr/999
    D:\node4>git checkout pr/999
    Branch pr/999 set up to track remote branch pr/1300 from origin.
    Branch pr/999 set up to track remote branch pr/999 from origin.
    Switched to a new branch 'pr/999'
    ```

  6. @piscisaureus piscisaureus created this gist Aug 13, 2012.
    39 changes: 39 additions & 0 deletions pr.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@

    Locate the section for your github remote in the `.git/config` file. It looks like this:

    ```
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:joyent/node.git
    ```

    Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

    ```
    [remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = [email protected]:joyent/node.git
    fetch = +refs/pull/*/head:refs/remotes/origin/pr/*```
    ```

    Now fetch all the pull requests:

    ```
    $ git fetch origin
    From github.com:joyent/node
    * [new ref] refs/pull/1000/head -> origin/pr/1000
    * [new ref] refs/pull/1002/head -> origin/pr/1002
    * [new ref] refs/pull/1004/head -> origin/pr/1004
    * [new ref] refs/pull/1009/head -> origin/pr/1009
    ...
    ```

    To check out a particular pull request:

    ```
    $ git checkout pr/999
    D:\node4>git checkout pr/999
    Branch pr/999 set up to track remote branch pr/1300 from origin.
    Switched to a new branch 'pr/999'
    ```