

查看远端的仓库
git remote -v
与远端建立联系
git remote add 远端名字 远端地址
将代码push到远端

此时本地有三个分支,但是push时master失败,是因为远端master有个LICENSE文件,而本地没有。需要先把远端拉取到本地。
git pull:拉取 + mergegit featch 远端名称 远端分支:拉取远端代码,并且不会和本地代码产生关联。

现在是三课独立的树,remote/github/master和 master都没有共同的祖先。
显示本地和远端的所有分支
git branch -va
因为push时master分支发生了错误,所以切换到master分支
git checkout master
此时进行merge操作,会发生错误,因为是两个不相关的历史
git merge github/master
使用--allow-unrelated-histories
git merge --allow-unrelated-histories github/master


此时,本地master和远端的master是fast-forwards关系,此时从gitk -all中发现了基于远端master,创建了一个新的commit, 此时在push时不会发生错误。

此时,远端和本地的master指向是相同的了。
此时,github中的master分支有5次commit了,和本地相同了。
