Git 怎样保证fork出来的project和原project(上游项目)同步更新

1.  在 Fork 的代码库中添加上游代码库的 remote 源,该操作只需操作一次即可。

如: 其中# upstream 表示上游代码库名, 可以任意。

git remote add upstream https://github.scm.corp.ebay.com/montage/frontend-ui-workspace

2. 将本地的修改提交 commit

3. 在每次 Pull Request 前做如下操作,即可实现和上游版本库的同步。

      3.1 : git remote update upstream

      3.2 : git rebase upstream/{branch name}

需要注意的是在操作3.2之前,一定要将checkout到{branch name}所指定的branch,

如: git checkout develop

4. Push 代码到 Github

git push

转自: http://www.tuicool.com/articles/Mnmmqyi

原文地址:https://www.cnblogs.com/pinganzi/p/4962473.html