美文网首页
Gitlab fork项目如何同步源项目更新

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

作者: arthub | 来源:发表于2017-10-23 20:37 被阅读102次
  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 +-

相关文章

网友评论

      本文标题:Gitlab fork项目如何同步源项目更新

      本文链接:https://www.haomeiwen.com/subject/msqzuxtx.html