Skip to content

Fork 仓库同步更新 (Keeping a fork up to date)

Alex Li edited this page Apr 16, 2021 · 3 revisions

保证 Forked 的仓库与主仓库更新

我们假设译者 fork 了本项目,则与主仓库保持同步的思路为:

git clone 省去

cd flutter.cn
git remote add cfug https://github.com/cfug/flutter.cn.git
git fetch cfug
git pull cfug master
git push

负责与全球文档同步的 maintainers,可以做如下设定:

cd flutter.cn
git remote add cfug https://github.com/cfug/flutter.cn.git
git remote add flutter https://github.com/flutter/website.git
git fetch cfug
git pull cfug master
git fetch flutter
git pull flutter master
# 处理冲突之后,git add, commit, push.
git push

如果只是同步某个 PR 的内容到现在到仓库,等待下一步工作的话,操作如下:

git remote add wip https://github.com/flutter/website.git
git fetch wip refs/pull/PR编号/head
git pull wip refs/pull/PR编号/head

这样,就把远程分支的某个 PR 检出到本地,可以开始下一步操作。