mirror of
https://github.com/tiimgreen/github-cheat-sheet.git
synced 2025-08-10 01:46:37 +02:00
checking out pull requests
This commit is contained in:
42
README.md
42
README.md
@@ -89,6 +89,48 @@ This closes the issue and references the closing commit.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## Checking out pull requests
|
||||||
|
|
||||||
|
If you want to check out pull request locally, you can fetch it using that command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git fetch +refs/pull/*/head:refs/pull/*
|
||||||
|
```
|
||||||
|
|
||||||
|
then, checkout pr (i.e. 42) using
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout refs/pull/42
|
||||||
|
```
|
||||||
|
|
||||||
|
Alternatively, you can fetch them as remote branches:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git fetch +refs/pull/*/head:refs/remotes/origin/pr/*
|
||||||
|
```
|
||||||
|
|
||||||
|
and checkout as
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ git checkout origin/pr/42
|
||||||
|
```
|
||||||
|
|
||||||
|
and even fetch them automatically, if you add corresponding lines in your .git/config:
|
||||||
|
|
||||||
|
|
||||||
|
```
|
||||||
|
[remote "origin"]
|
||||||
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||||
|
url = git@github.com:tiimgreen/github-cheat-sheet.git
|
||||||
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
[remote "origin"]
|
||||||
|
fetch = +refs/heads/*:refs/remotes/origin/*
|
||||||
|
url = git@github.com:tiimgreen/github-cheat-sheet.git
|
||||||
|
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
|
||||||
|
```
|
||||||
|
|
||||||
## Cross-link issues
|
## Cross-link issues
|
||||||
|
|
||||||
If you want to link to another issue in the same repo, simple type hash `#` then the issue number, it will be auto-linked.
|
If you want to link to another issue in the same repo, simple type hash `#` then the issue number, it will be auto-linked.
|
||||||
|
Reference in New Issue
Block a user