1、与远程仓库建立链接
1、首先本地初始化一个仓库,再建立连接
git init
git remote add origin https:xxx.git
2、直接克隆远程仓库,实现连接
git clone 默认克隆的是主分支
git clone http://xx.git
2、可以只克隆单个分支
git clone -b 分支名 http://xx.git
克隆多分支
列出所有分支
git branch -a
*代表当前分支
查看远程仓库的所有分支
git branch -r
在本地新建分支并与远程相关联,并切换到当前分支(template为分支名称)
git checkout -b template origin/template
3、添加更新到远程
添加新加入的文件到暂存区
git add .
提交更新文件到本地仓库-m‘提交信息’
git commit -m'提交信息'
上传本地更新文件到远程仓库
git push
4、拉取远程分支到本地
建立仓库,并远程连接后,拉取远程分支到本地仓库(template为分支名称)
git fetch origin template
新建本地分支
git branch template
把远程分支上的内容拉取到本地
git pull origin template