一、连接:
git config --global user.name "自己的名字"
git config --global user.email "自己的邮箱"
二、克隆到本地
git clone https://项目地址.git
三、上传
git add -A 全部上传
git commit -m "修改信息"
git commit 不加参数,填写信息
git push
git push origin master //push到远程主分支master
git push origin test //push到远程test分支
git pull//更新本地仓库
git status //查看修改
四:分支
git checkout -b test //新建一个分支 在分支中操作
git branch //查看分支
五:从服务器master更新代码到本地分支test
第一种
1. 切到本地test $ git checkout test
2. 从服务器的master拉代码: $ git pull
第二种
1. 切换到本地的master: $ git checkout master
2. 拉代码: $ git pull origin master
3. 切到本地test: $ git checkout test
4. 合代码: $ git merge master
第三种:
1. 切到master: $ git checkout master
2. 删除本地test分支: $ git branch -d test
3. 再从master分出新的test分支: $ git checkout -b test
更新本地
如果在test下
git fetch origin master 从远程master下载最新到origin/master
git log -p test..origin/master 比较本地的master分支和origin/master分支的差别
git merge origin/master 最后进行合并