在使用 git 进行分支开发与合并的时候需要用到这些命令。其他基本 git 命令参考 Git 简易食用指南
git branch
查看分支
git branch
查看当前分支情况

创建分支
git branch 分支名
创建一个新的分支
切换分支
git checkout 分支名
切换到该分支
分支提交到线上
git add .
git commit -m "xxx"
git remote add origin github项目地址
//如果出现remote origin already exists
git remote rm origin
git remote add origin github项目地址
git push origin index-swiper //(index-swiper 为branch 分支名)

合并到 master
git checkout master //切换到 master
git merge origin/index-swiper //选择要合并到 master 的分支
git push origin master //push 即可

网友评论