[转]更新远程代码到本地仓库
更新远程代码到本地仓库
-
方式一
-
查看远程仓库
$ git remote -v
eoecn https://github.com/**************************(fetch) eoecn https://github.com/**************************(push) origin https://github.com/**************************(fetch) origin https://github.com/**************************(push)从结果看,远程仓库有两个,一个是eoecn,一个是origin
-
从远程获取最新版本到本地
$ git fetch origin master
From https://github.com/*********************** * branch master ->FETCH_HEADgit fetch orgin master: 从远程的origin仓库的master分支下载到本地的origin master-
比较本地的仓库和远程参考的区别
$ git log -p master.. origin/master -
吧远程下载的代码合并到本地仓库,远程的和本地的合并
$ git merge origin/master
-
-
方式二
-
查看远程分支,同方式一的第一步
-
从远程获取最近版本到本地
$ git fetch origin master:temp
From https://github.com/*********************** * [new branch] master ->tempgit fetch origin master:temp: 从远程的origin仓库的master分支下载到本地并新建一个分支temp-
比较本地的长裤和远程参考的区别
$ git diff tempgit diff temp: 比较master分支和temp分支的不同 -
合并temp分支到master分支
$ git merge temp -
如果不想要temp分支,可以将此删除
$ git branch -d temp
-

浙公网安备 33010602011771号