git clone //拉取代码
git branch -a //查看所有分支(本地、远程)
git branch //查看本地分支(当前分支前有*)
- 提交代码流程
git status //查看本地更改文件
git diff //查看具体更改内容
git add --all(git add .) //提交新增文件
git commit -a'注释' // 提交修改文件
git pull //拉取远程分支
git push //push到远程分支
- 新建分支并切换
git checkout -b 分支名
//相当于下面两条命令
git branch 分支名
git checkout 分支名
- 合并到master分支
git checkout master
git pull origin master
git merge dev(分支名)
git status - git add --all -git commit -am git pull
git push origin master
- master分支pull到自己分支
git checkout master
gut pull
git checkout 自己分支
git merge master
gut push
- 删除分支
git branch -D dev //删除本地分支
git push origin :dev //删除远程分支(origin 后面有空格,表示推送空格到远程dev分支)
- 打标签
git tag //查看所有标签
git tag -a v0.0.1 -m '0.0.1版本'
- 修改git远程地址
git remote set-url origin [url]
或者进入git/config修改
- 查看提交日志
git reflog
- 退回上一个版本
git reset --hard head^
- 退回到某个版本
git reset --hard HEAD@{14}
git reset --hard 8fbcb7b
- 本地分支未与远程关联,提示“the upstream branch of your current branch does not match the name of your current branch .To
push to the upstream brach on the remote ”
(1) git push -set-upstream origin 分支名 //远程已经有分支
(2) gti push -u origin 分支名 //远程没有此分支



