保持 fork 之后的项目和源仓库同步
This commit is contained in:
10
git.md
10
git.md
@ -204,13 +204,15 @@ git remote remove origin #取消与远程仓库关联
|
||||
|
||||
__保持 fork 之后的项目和源仓库同步__
|
||||
```
|
||||
git remote add upstream [upstream_url] #添加上游仓库 upstream 任意
|
||||
git remote add upstream [upstream_url] #1、添加上游仓库命名为 upstream
|
||||
|
||||
git fetch upstream #拉取最新代码
|
||||
git fetch upstream #2、拉取最新代码
|
||||
|
||||
git merge upstream/<branch_name> #将upstream/<branch_name> merge到本地当前分支
|
||||
git checkout master #3、切换分支
|
||||
|
||||
git push origin <branch_name> #push到自己的github仓库
|
||||
git merge upstream/<branch_name> #4、将 upstream/<branch_name> merge 到本地当前分支
|
||||
|
||||
git push origin <branch_name> #5、push 到自己的 github 仓库
|
||||
```
|
||||
|
||||
__暂存代码__
|
||||
|
Reference in New Issue
Block a user