Git fork code is updated synchronously

Background: I saw a very good project in Gitee, Fork went to his own warehouse, and git cloned his own warehouse for self-development. Later, the initial Fork project was updated, so I want to update the latest code and changed code of the initial Fork Integrate ..

 

First check the remote source locally, you can see the two sources of the original local warehouse copy

PS E:\workspace_idea\RuoYi-Vue> git remote -v
origin  https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
origin  https://gitee.com/easonstudy/RuoYi-Vue.git (push)

Now add the original Fork project source, and then check the remote source

PS E:\workspace_idea\RuoYi-Vue> git remote add upstream https://gitee.com/y_project/RuoYi-Vue.git
PS E:\workspace_idea\RuoYi-Vue> git remote -v
origin https://gitee.com/easonstudy/RuoYi-Vue.git (fetch)
origin https://gitee.com/easonstudy/RuoYi-Vue.git (push)
upstream https://gitee.com/y_project/RuoYi-Vue.git (fetch)
upstream https://gitee.com/y_project/RuoYi-Vue.git (push)

Then pull the upstream (Fork) code, there will be an upstream / master branch locally

PS E:\workspace_idea\RuoYi-Vue> git fetch upstream
From https://gitee.com/y_project/RuoYi-Vue
* [new branch] master -> upstream/master

Switch to the master branch of your own warehouse and merge upstream / master

PS E:\workspace_idea\RuoYi-Vue> git branch
* master
PS E:\workspace_idea\RuoYi-Vue> git checkout master
Already on 'master'
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
PS E:\workspace_idea\RuoYi-Vue> git merge upstream/master
Already up to date.

After updating, realize your own warehouse and Fork project in your local

 

Guess you like

Origin www.cnblogs.com/eason-d/p/12761340.html