fork或者派生之后,如果upstream的代码发生改变,例如别人修复了一些问题,我们该如何同步过来呢?
- 克隆代码库
git clone https://github.com/nshfany/calcite.git
- 查看已关联的远程库,此时只有默认关联仓库origin
nsh@StarMacBook calcite$ git remote -v
origin https://github.com/nshfany/calcite.git (fetch)
origin https://github.com/nshfany/calcite.git (push)
- 关联到upstream远程仓库
git remote add upstream https://github.com/apache/calcite.git
nsh@StarMacBook calcite$ git remote -v
origin https://github.com/nshfany/calcite.git (fetch)
origin https://github.com/nshfany/calcite.git (push)
upstream https://github.com/apache/calcite.git (fetch)
upstream https://github.com/apache/calcite.git (push)
- 抓取upstream
git fetch upstream