图解
创建分支
git branch xxxxx
切换分支
git checkout xxxxx
推送分支到远程版本库
// 先切换到刚新建的分支
git checkout xxxxx
// 然后将本地新建的分支push
git push --set-upstream origin xxxxx
查看分支
// 参看本地分支
git branch
//
git branch -a
删除分支
// 删除本地分支
git branch -d xxxxx
// 删除远程分支
git push origin --delete xxxxx
合并分支
// 先切换到需要合并的分支branchA
git checkout branchA
// 合并branchB分支的代码
git merge branchB
// 将从branchB合并过来的代码提交
git push
提交代码
// 添加一个或多个文件到暂存区
git add xxxxx
git add xxxxx xxxxx xxxxx
// 全部添加
git add .
// 提交暂存区到本地仓库。
git commit -m "xxxxxx"
// 提交代码前注意要保证本地代码是最新的
git push
更新代码
git pull
参看当前状态
git status
参看日志
// 键盘按q退出log模式
git log