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

评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值