#创建dev分支 ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch dev ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -a #在dev分支上进行操作同步服务器 ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git checkout dev ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -a rmyQins-Mac-mini:vue-ssr-tech armyqin$ git pull origin master #在dev分支上进行操作提交到服务器 ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git add . ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git commit -m 'ss' ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git push -u origin master #在master分支上进行操作 ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git checkout master ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -a ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git merge dev #在master分支上进行操作 ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git checkout master ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -a ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -D dev ArmyQins-Mac-mini:vue-ssr-tech armyqin$ git branch -a
常用命令
#创建分支 git branch dev #查看所有分支 git branch -a #切换分支 git checkout dev #同步服务器 git pull origin master #添加新文件 git add . #提交到本地仓库 git commit -m 'init' #提交到服务器 git push -u origin master #切换到master分支 git checkout master #在master分支上进行操作 git merge dev #在master分支上进行操作 git checkout master git branch -D dev
##总结
##查看分支
git branch -a
##创建分支
git branch name
##切换分支
git checkout name
##创建并切换
git checkout -b name
##合并某分支到当前分支
git merge name
##删除分支
git branch -D name