Browse Source

保持 fork 之后的项目和源仓库同步

Nick 2 years ago
parent
commit
098036e8e6
1 changed files with 6 additions and 4 deletions
  1. 6 4
      git.md

+ 6 - 4
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 仓库
 ```
 
 __暂存代码__