设置用户名和邮箱
git config --global user.email 'xxx'
git config --global user.name 'xxx'
创建分支
git branch xxx
切换分支
git checkout xxx
创建并且换分支
git chekout -b xxx
创建远程分支
git push origin xxx
删除分支
git branch -D xxx
删除远程分支
git push origin --delete
重命名分支
1、git branch -m 要改的本地分支名 修改后的分支名(修改本地分支)
2、 git push origin :远程修改前的分支名(删除远程分支)
3、git push origin 修改后的分支名:修改后的分支名(push 到远程分支)
4、git branch --set-upstream 修改后的分支名 origin/修改后的分支名(绑定远程分支)
查看提交日志
git log
查看变动
git diff
合并分支
git merge xxx
合并多个提交
git rebase -i (interactive) startpoint endpoint
这个解释起来比较麻烦,参考地址:https://www.jianshu.com/p/4a8f4af4e803
同步远程分支到本地
git fetch
git reflog --date=local | grep 分支名
查看git log的图
git log --graph --all --decorate