Github进行fork后如何与原仓库同步

Posted ur home

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Github进行fork后如何与原仓库同步相关的知识,希望对你有一定的参考价值。

## 1.查看远程仓库的路径
$ git remote -v
origin  https://github.com/wz930206/lifeRestart.git (fetch)
origin  https://github.com/wz930206/lifeRestart.git (push)

## 2.在自己fork出来的库里面去操作
$ git remote add upstream https://github.com/VickScarlet/lifeRestart.git

## 3.查看远程仓库的路径
$ git remote -v
origin  https://github.com/wz930206/lifeRestart.git (fetch)
origin  https://github.com/wz930206/lifeRestart.git (push)
upstream        https://github.com/VickScarlet/lifeRestart.git (fetch)
upstream        https://github.com/VickScarlet/lifeRestart.git (push)

## 4.抓取原仓库的修改文件
$ git fetch upstream
remote: Enumerating objects: 49, done.
remote: Counting objects: 100% (49/49), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 49 (delta 21), reused 28 (delta 13), pack-reused 0
Unpacking objects: 100% (49/49), 724.12 KiB | 988.00 KiB/s, done.
From https://github.com/VickScarlet/lifeRestart
 * [new branch]      master     -> upstream/master

## 5.切换到master分支 我当前是master分支 
$ git branch
* master

## 6.合并远程的master分支
$ git merge upstream/master
Auto-merging src/app.js
Auto-merging public/bundle.js
CONFLICT (content): Merge conflict in public/bundle.js
Automatic merge failed; fix conflicts and then commit the result.

## 7.此时你电脑上的本地仓库和github原仓库同步了,但你自己的github仓库还没有同步
$ git push
Everything up-to-date

以上是关于Github进行fork后如何与原仓库同步的主要内容,如果未能解决你的问题,请参考以下文章

Github进行fork后如何与原仓库同步

Github进行fork后如何与原仓库同步

Github进行fork后如何与原仓库同步

Github代码fork之后,如何与原仓库进行同步?

Git进行fork后如何与原仓库同步

[GitHub] 保持 Fork 后的仓库与原仓库同步