1GIT-PR(1)                         Git Extras                         GIT-PR(1)
2
3
4

NAME

6       git-pr - Checks out a pull request locally
7

SYNOPSIS

9       git-pr <number> [<remote>]
10       git-pr <[remote]:number>...
11       git-pr <url>...
12       git-pr clean
13

DESCRIPTION

15       Creates  a  local  branch based on a GitHub pull request number or URL,
16       and switch to that branch afterwards.
17

OPTIONS

19       <remote>
20
21       The name of the remote to fetch from. Defaults to origin.
22
23       <url>
24
25       GitHub      pull      request       URL       in       the       format
26       https://github.com/tj/git-extras/pull/453.
27

EXAMPLES

29       This checks out the pull request 226 from origin:
30
31
32
33           $ git pr 226
34
35           remote: Counting objects: 12, done.
36           remote: Compressing objects: 100% (9/9), done.
37           remote: Total 12 (delta 3), reused 9 (delta 3)
38           Unpacking objects: 100% (12/12), done.
39           From https://github.com/tj/git-extras
40            * [new ref]         refs/pull/226/head -> pr/226
41
42           Switched to branch ´pr/226´
43
44
45
46       This pulls from a different remote:
47
48
49
50           $ git pr 226 upstream
51
52
53
54       This does the same thing as the command above:
55
56
57
58           $ git pr upstream:226
59
60
61
62       You can also checkout a pull request based on a GitHub URL:
63
64
65
66           $ git pr https://github.com/tj/git-extras/pull/453
67
68           From https://github.com/tj/git-extras
69            * [new ref]         refs/pull/453/head -> pr/453
70           Switched to branch ´pr/453´
71
72
73
74       You could even pull multiple pull requests via the GitHub URL or the ID
75       with remote specified:
76
77
78
79           $ git pr upstream:226 upstream:443
80           $ git pr upstream:443 https://github.com/tj/git-extras/pull/453
81
82
83
84       Note that git pr PR-A PR-B is equal to:
85
86
87
88           $ git pr PR-A
89           $ git pr PR-B
90
91
92
93       Therefore, if one of the pull request is failed to pull,  this  command
94       will  still  go  ahead and pull the others. The final exit code will be
95       decided by the result of the final pulling.
96
97       To clean up old branches:
98
99
100
101           $ git pr clean
102
103           Deleted branch pr/226 (was b96a8c2).
104           Deleted branch pr/220 (was d34dc0f).
105
106
107

AUTHOR

109       Originally from https://gist.github.com/gnarf/5406589
110

REPORTING BUGS

112       <https://github.com/tj/git-extras/issues>
113

SEE ALSO

115       <https://github.com/tj/git-extras>
116
117
118
119                                 February 2019                       GIT-PR(1)
Impressum