git remote add upstream https://github.com/studygolang/GCTT
添加fork项目的远程仓库(只需操作一次)
此时使用
git remote -v
zuoguoyaodeMacBook-Pro:GCTT zuoguoyao$ git remote -v
origin https://github.com/zuoguoyao/GCTT.git (fetch)
origin https://github.com/zuoguoyao/GCTT.git (push)
upstream https://github.com/studygolang/GCTT.git (fetch)
upstream https://github.com/studygolang/GCTT.git (push)
git fetch upstream
获取上游改动
git checkout master
转到master分支
git rebase upstream/master
合并分支,结果等同于merge.git实现的机制不一样
参考下文
http://gitbook.liuhui998.com/4_2.html
git push -f origin master
强制(-f )覆盖远程 origin仓库的master分支