远程仓库
Git 远程仓库相当的操作实际可以归纳为两点:向远程仓库传输数据以及从远程仓库获取数据。
Clone
克隆远程仓库代码 克隆过来的项目代码是一般是没有node_modules文件夹的,需要用npm i(全写:install) 下载所用的依赖
git clone <远程仓库地址>
练习: 执行前 
git clone
执行后 
远程分支
远程分支(类似origin/master等)反映了远程仓库(在你上一次拉远程代码时)的状态,在你检出时自动进入分离 HEAD 状态。 远程分支命名规范:
<remote name>/<branch name>
origin/master
练习: 执行前 
git checkout o/master
git commit
执行后  commit提交后,就分离 出HEAD 状态,当添加新的提交时 o/master 也不会更新。这是因为 远程分支只有在远程仓库中相应的分支更新了以后才会更新。 例子: 
git commit
git checkout o/master
git commit
fetch
从远程仓库获取数据 fetch 通常通过互联网(使用 http:// 或 git:// 协议) 与远程仓库通信。 将本地仓库中的远程分支更新成了远程仓库相应分支最新的状态。 fetch 并不会改变你本地仓库的状态。也不会修改你磁盘上的文件 练习: 执行前 
git fetch
从远程仓库下载本地仓库中缺失的提交记录;更新远程分支指针( o/master)。
执行后  例子练习:
git fetch

Pull
更新远程分支代码,与本地分支分支合并 若远程仓库只有一条分支可直接使用git pull,若有多条分支则使用 git pull <远程仓库名称>/<分支名称>
执行前: 
git fetch
git merge o/master
执行后: 
git pull == git fetch;git merge <分支名>;
例子练习:
git pull
git fetch
git merge o/master

模拟团队提交
git fakeTeamwork :在远程仓库的 分支(默认是master)上做提交。
git fakeTeamwork <分支名> Num(提交次数)
git fakeTeamwork develop 3
git fakeTeamwork
执行前:  执行后
git fakeTeamwork

执行前  执行后
git fakeTeamwork foo 3
 例子练习: 
git clone
git fakeTeamwork 2
git fetch
git commit
git merge o/master
git commit
git pull
push
负责将本地分支的变更上传到指定的远程仓库,并在远程仓库上合并新的提交记录,然后更新本地的远程分支
执行前  执行后
git push
 例子练习 
git commit
git commit
git push
推送冲突(偏离的工作)
远程仓库中的分支是最新,而本地仓库中的代码是旧,远程仓库中有更改,与本地的有冲突
执行前 
执行后
git fetch
git rebase o/master
git push
 执行前 
执行后
git fetch
git merge o/master
git push

git pull == git fetch;git merge <branch>
git pull --rebase == git fetch;git rebase <branch>
执行前  执行后
git pull --rebase
git push
例子练习 
git clone
git fakeTeamwork
git commit
git pull --rebase
git push
|