Gitlab fork项目如何同步源项目更新

2017-10-23  本文已影响102人  arthub
  1. 查看配置
$ git remote -v
origin  http://ForkProject.git (fetch)
origin  http://ForkProject.git (push)
  1. 添加源项目地址
$ git remote add upstream http://SourceProject.git(源项目地址)
  1. 查看添加源项目地址后的配置
$ git remote -v
origin  http://ForkProject.git (fetch)
origin  http://ForkProject.git (push)
upstream  http://SourceProject.git(fetch)
upstream  http://SourceProject.git(push)
  1. 获取源项目更新
$ git fetch upstream
remote: Counting objects: 15, done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 15 (delta 14), reused 0 (delta 0)
Unpacking objects: 100% (15/15), done.
From http://SourceProject
 * [new branch]      branchA    -> upstream/branchA
 * [new branch]      master     -> upstream/master
  1. 合并源项目更新
$ git merge upstream/branchA(需要同步的分支)
Updating 462352a..4a23f6a
Fast-forward
 FileA.txt          |  6 +++---
 FileB.sh           |  2 +-
上一篇 下一篇

猜你喜欢

热点阅读