4
在gitlab中创建合并请求时,我经常会收到一条消息: 请求将branch-A合并为develop([x]提交后面) gitlab要告诉我什么? 我应该担心还是需要解决某些问题?gitlab如果我担心,请求将branch-A合并为develop(3 commit后面)
在gitlab中创建合并请求时,我经常会收到一条消息: 请求将branch-A合并为develop([x]提交后面) gitlab要告诉我什么? 我应该担心还是需要解决某些问题?gitlab如果我担心,请求将branch-A合并为develop(3 commit后面)
经过一段时间后合并请求在项目中打开,因为其他人将其更改合并到其中,所以您试图合并到的分支版本已过时是正常的。
Gitlab通过显示您更新的分支版本位于远程分支后面来帮助您。
落后并不会妨碍合并行为,但在您合并的分支之上对您的提交进行rebase
是一种常见做法。这将使你的合并请求更新,将你的提交按照时间顺序放在那些已经在那个分支上的提交之后。这种方法使合并负责人的工作更容易,因为提交者本身已经解决了可能发生的任何冲突。
做一个rebase
你提出会是这样的场景如下:
# Add a remote named `upstream` pointing to the original repository
git remote add upstream https://gitlab.example.com/example/your_project.git
# Fetch the latest commmits from `upstream`
git fetch upstream
# Checkout our branch-A
git checkout branch-A
# Rebase our branch on top of the `upstream/develop` branch
git rebase upstream/develop
# If needed fix any conflicts that may have appeared and then `git rebase --continue`
# Push the changes to the branch of your merge request
git push --force origin branch-A
注:的--force是必要的,当你推,因为你正在重写分支的提交历史。
感谢您的全面回答。但是,我需要'git remote add upstream'来做什么?如果所有的远程分支都已经被获取,那么是不是也可以只做一个'git rebase develop'? –
你可以合并而不是rebase。否则,你知道你做了什么,我不会推荐rebasing –