gitlab在项目中添加分支,一整套流程
- 0、打开git bash的操作
- 1、git status
- 2、git pull origin develop
- 3、git checkout -b 自己的分支,以feature开头,例如"feature/rm10465-name-20230720-contract-price"
- 4、git push origin feature/rm10465-name-20230720-contract-price
- 5、git checkout develop
- 6、git checkout test/2022032101
- 7、git pull
- 8、git pull origin feature/rm10465-name-20230720-contract-price
- 9、git add .
- 10、git commit -m 'rm10465: 修改xxx内容'
- 11、git push origin test/2022032101
0、打开git bash的操作
在一个项目中,自己要添加自己的分支,首先在那个项目,你要添加分支的文件夹,右键。选择打开方式,然后选最上面这个 explorer。
1、git status
查看当前状态,合并、提交、拉取操作前都需要执行
2、git pull origin develop
拉取远端的develop分支到本地的当前分支
(一般push前要先会合并develop,避免与develop冲突,也能及时同步到其他人的代码)
3、git checkout -b 自己的分支,以feature开头,例如"feature/rm10465-name-20230720-contract-price"
基于当前分支创建新分支
4、git push origin feature/rm10465-name-20230720-contract-price
将当前分支推送到远端
5、git checkout develop
切换到指定分支
6、git checkout test/2022032101
这个是切到测试,一般不用点,这个就直接跳过就好。在最后merge,合并分支时,再用这个test。
这个第六步,直接跳过
git checkout develop之后,就直接git pull origin develop
7、git pull
already up to date 相当于测试一下 有没有成功up to date
8、git pull origin feature/rm10465-name-20230720-contract-price
拉取远程最新的分支,如果有冲突则修改,重新commit
9、git add .
将工作区所有修改内容添加到暂存区
10、git commit -m ‘rm10465: 修改xxx内容’
以’rm10465: 修改xxx内容’作为message提交
11、git push origin test/2022032101
将当前分支推送到远端