前言

今天分享如何在本地 Review 别人的 Pull Request(以下简称PR)。

操作

假设你已经克隆了对应的仓库。

GitHub 找到要 Review 的 PR,获取 title 对应的数字,例如414,只要数字即可,不用带# 把 PR 拉取到本地,并新建分支

1
2
3
# git fetch origin pull/[改成刚刚获取的数字]/head:[新分支名]
# 假设我要对 414 这个 PR 进行 Review
git fetch origin pull/414/head:doc

切换到新分支

1
2
3
# git switch [新分支名]
# 刚刚分支是 doc
git switch doc

这时候就可以愉快的 Review 了。

参考

Checking out pull requests locally - GitHub Docs