File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -513,32 +513,21 @@ $ git stripspace < README.md
513513[ * 进一步了解 Git ` stripspace ` 命令.* ] ( http://git-scm.com/docs/git-stripspace )
514514
515515### 检出Pull Requests
516- 如果想检出pull requests到本地,可以先用下面的fetch命令 :
516+ Pull Request是一种GitHub上可以通过以下多种方式在本地被检索的特别分支 :
517517
518- ``` bash
519- $ git fetch origin ' +refs/pull/*/head:refs/pull/*'
520- ```
521-
522- 然后用checkout命令检查想要的Pull Request(比如42)
518+ 检索某个分支并临时储存在本地的` FETCH_HEAD ` 中以便快速查看更改(diff)以及合并(merge):
523519
524520``` bash
525- $ git checkout refs/pull/42
521+ $ git fetch origin refs/pull/[PR-Number]
526522```
527523
528- 你也可以把它们当作远程分支来fetch :
524+ 通过refspec获取所有的Pull Request为本地分支 :
529525
530526``` bash
531527$ git fetch origin ' +refs/pull/*/head:refs/remotes/origin/pr/*'
532528```
533529
534- 然后这样检出:
535-
536- ``` bash
537- $ git checkout origin/pr/42
538- ```
539-
540- 或者干脆在你的.git/config文件里添加如下内容,这样就可以自动获取它们了。
541-
530+ 或在仓库的` .git/config ` 中加入下列设置来自动获取远程仓库中的Pull Request
542531```
543532[remote "origin"]
544533 fetch = +refs/heads/*:refs/remotes/origin/*
@@ -552,6 +541,12 @@ $ git checkout origin/pr/42
552541 fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
553542```
554543
544+ 对基于派生库的Pull Request,可以通过先` checkout ` 代表此Pull Request的远端分支再由此分支建立一个本地分支:
545+
546+ ``` bash
547+ $ git checkout pr/42 pr-42
548+ ```
549+
555550[ * 进一步了解如何检出pull request到本地.* ] ( https://help.github.com/articles/checking-out-pull-requests-locally )
556551
557552### 提交空改动 :trollface:
You can’t perform that action at this time.
0 commit comments