多人开发git分支创建及步骤(命令行)
- 创建分支 :
git branch 分支名
- 切换分支
git checkout 分支名
- 查看分支
git branch
- 创建并切换到分支
git checkout -b 分支名
- 合并分支,合并分支到当前分支
git merge 分支名
- 提交到本地仓库
git commit -m "描述"
- 提交到远程仓库
git push origin 分支名
- 删除分支:
git branch -d 分支名
具体操作流程如下:
如果接到一个新功能,但是不确定哪个版本发布,可以使用分支操作
首先将项目clone到本地
cd Desktop/
git clone http://xxx.git
cd BranchTest/
创建并切换到分支
git checkout -b verification
打开Xcode完成开发
提交修改到本地仓库
git add .
git commit -m “提交代码”
提交修改到远程仓库
git push origin verification
至此,代码完成。
git提交报错:原因是存在符号转移问题。解决办法:
git config --global core.autocrlf false