1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > git使用 多分支合并代码解决冲突 git删除远程分支 删除远程master默认分支方法...

git使用 多分支合并代码解决冲突 git删除远程分支 删除远程master默认分支方法...

时间:2024-06-27 00:41:36

相关推荐

git使用 多分支合并代码解决冲突 git删除远程分支 删除远程master默认分支方法...

git使用,多分支合并代码解决冲突,git删除远程分支,删除远程master默认分支方法

提交代码流程:

1.先提交代码到自己分支上

2.切换到devlop拉取代码合并到当前分支

3.合并后有变动的推送到自己分支

3.到web上 /mobile/exchange 上选择自己的分支,

点击 Create Merge Requests ,选择合并到devlop分支,Description填写修改内容,提交。

New Merge Request -->默认到master的,点右上角Change branches-->Target branch 选择devlop,点击Compare branches and continue按钮,

-->Description填写修改内容-->点击Submit merge request-->Merge(如果按钮是灰色的会提示There are merge conflicts有合并冲突,需要解决冲突才能合并)

------------------

Introduction to GitLab Flow | GitLab

/ee/workflow/gitlab_flow.html

------------------

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin

git checkout -b devlop origin/devlop

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin

git checkout origin/qa

git merge --no-ff devlop

Step 4. Push the result of the merge to GitLab

git push origin qa

Tip: You can also checkout merge requests locally by following these guidelines.

--------------------

git删除远程分支

先查看远程分支

git branch -r

使用下面两条命令来删除远程分支

git branch -r -d origin/branch-name

git push origin :branch-name

在gitlab和github中可以在 project setting中更改 default branch

默认不一定非得是master, 也可以是其他, 比如新建分支temp, 把temp分支设置为 默认分支, 也就是主分支吧 , 不过按照约定俗称的说法, 还是以master作为默认的主分支。

git删除master分支后重建

每次误操作后,都会引起当前分支低于远程的master分支,然后导致无法完成git push origin master:master。

如果用:

git branch -D master;//删除本地master分支

git push origin :master;//删除远程master分支

会发现删除不了,因为在本地您处在master分支,在远程master为默认分支

解决之道:

1.先建立自己的分支。

git branch temp;

git push origin temp:temp;//将temp分支提交到远程分支上。

2.在github上将master分支设置成不是default的分支,这里就要选择temp分支了,因为只有两个分支。

github操作,点击后面的settings,选择不是master的分支为默认。

3.再使用删除:

git branch -D master;//删除本地master分支

git push origin :master;//删除远程master分支

这样就完成删除了。

4.如果你还想在将master分支做为默认的分支,再建一个叫master的分支,然后类似操作(将内容提交到master分支上,push到远程的github上,进入settings中设置master为默认的分支即可。)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。