1. 查看远程仓库:
git remote -v
2. 查看temp分支与本地原有分支的不同:
git diff temp
3. 将temp分支和本地的master分支合并:
git merge temp
现在,B的本地代码已经和远程仓库处于同一个版本
最后再提一下,上面的步骤中我们创建了temp分支,如果想要删除temp分支,也是可以的,命令如下:
git branch -d temp
4.查看所有分支:
git branch -a
5.查看当前使用分支(结果列表中前面标*号的表示当前使用分支):
git branch
6.切换分支:
git checkout 分支名
本地关联远端仓库
#git初始化
git init
#设置remote地址
git remote add origin 地址
#获取远程仓库master分支上的内容
git pull origin master
#将当前分支设置为远程仓库的master分支
git branch --set-upstream-to=origin/master master
#将全部文件加入git版本管理 .的意思是将当前文件夹下的全部文件放到版本管理中
git add .
#提交文件 使用-m 编写注释
git commit -m “注释”
#推送到远程分支
git push
版本回退
$ git reset --hard 版本id