Pull Request 小帖士

栏目: 编程工具 · 发布时间: 5年前

内容简介:一般地,本地 forked repo 有两个远端:更新方法pull request 会追踪发起它的远端分支(简称 PR 分支,本地副本被称为“本地PR 分支”),除非已被 merge 或者处于 close 状态。

Forked Repo

一般地,本地 forked repo 有两个远端:

upstream
origin

更新方法

# 切换到 master 分支
git checkout master
# 拉取原作者的 repo
git pull upstream master:master
# 更新 forked repo
git push origin master:master
# 更新 forked repo 的远端分支
git remote update --prune

Pull Request 追踪特性

pull request 会追踪发起它的远端分支(简称 PR 分支,本地副本被称为“本地PR 分支”),除非已被 merge 或者处于 close 状态。

  • 如果 pull request 被 merge,PR 分支可以被原作者删除。
  • 如果 pull request 被 close,PR 分支可以被原作者删除。一旦删除,该 pull request 就不能再被 reopen。

预览 Pull Request 合并后的状态

首先,更新 repo。

其次,搭建预览现场。此时完全不用担心 conflict(除非 GitHub 网页已经指出)。

git checkout -b [预览分支]
git pull [发起 repo 的 URL] [发起分支]

然后,预览(一般是测试)。

最后,清理预览现场。

git checkout master
git branch -D [预览分支]

解决 Pull Request 冲突

GitHub 的 pull request 页面指出 PR 冲突,可用下列方法解决:

首先,更新 repo。

然后,将 master 分支合并到本地 PR 分支。此时必然发生 conflict,解决并新建 commit。建议使用 GitHub Desktop 或 IDE 来执行该步骤。

最后,push 本地 PR 发起分支。

此时,GitHub 上的 pull request 会追加 commit,并指出冲突已消除。

Pull Request 与 Issue

GitHub 中 pull request 和 issue 共用一套编号。可在页面末尾添加的 comment,称为 issue comment。相关的 API 都在 这里

如果 commit message 包含 fix / fixes / fixed / close / closes / closed / resolve / resolves / resolved 等关键字加上 #编号 ,一旦 commit 被加入 repo,相应的 issue 就会被 close。


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

An Introduction to the Analysis of Algorithms

An Introduction to the Analysis of Algorithms

Robert Sedgewick、Philippe Flajolet / Addison-Wesley Professional / 1995-12-10 / CAD 67.99

This book is a thorough overview of the primary techniques and models used in the mathematical analysis of algorithms. The first half of the book draws upon classical mathematical material from discre......一起来看看 《An Introduction to the Analysis of Algorithms》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具