查看当前仓库状态
git status
将文件添加到缓存区
git add .
提交到本地仓库
git commit -m "描述信息"
查看历史提交日志
git log
回滚代码仓库
git reset --hard commitID
查看分支
git branch
创建分支
git branch 分支名
切换分支
git checkout 分支名
将分支a合并到所在分支
git merge 分支a
合并时解决冲突
处理文件中冲突的地方
git add .
git commit -m "描述信息"
添加远程仓库
git remote add 远程仓库名 远程仓库地址
查看远程仓库
git remote
代码push到远程仓库
git push 远程仓库名 本地分支名:远程分支名
指定本地和远程分支关联后push
git push --set-upstream 远程仓库名 本地分支名:远程分支名
git push
从远程仓库抓取到本地,但不会合并
git fetch 远程仓库名 分支名
从远程仓库抓取并合并到本地,相当于fetch+merge
git pull 远程仓库名 分支名