多人协作
Last updated
Was this helpful?
Last updated
Was this helpful?
本节将介绍一个多人协作的例子。
假设 是一个远程空仓库。
1、A主机初始化远程仓库
首先,在A主机上新建一个learngit仓库,创建master分支与dev分支
然后同步到远程的learngit仓库
2、B主机克隆远程仓库
在B主机上克隆远程仓库的master分支下来
再拉取远程仓库的dev分支下来
3、A主机修改master分支
A主机修改master分支下的readme.md文件,然后commit、pull并push
说明,最后两行 git pull
与 git push
其实等价于 git pull origin master
与 git push origin master
, 由于在步骤1中第一次push时的命令 git push -u origin master
添加了参数 -u ,相当于把本地的master分支与origin的master分支建立了连接,所以后面再pull与push的时候,就可以省略远程仓库的名字与分支了
4、B主机修改master分支
B主机修改master分支下的readme.md文件,然后commit、pull、处理冲突、push