作者:GYuan83_844 | 来源:互联网 | 2023-02-10 11:55
在gitlab中创建合并请求时,我经常收到一条消息:请求将branch-A合并到develop([x]后面提交)gitlab想要告诉我什么?我应该担心还是需要修理一些东西(什么)?
1> alejdg..:
在一段时间内,在项目中打开合并请求通常会导致您尝试合并的分支版本因其他人将其更改合并到其中而过时.
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,因为您正在重写分支的提交历史记录.
你可以合并而不是rebase.或者你知道你做了什么,我不建议改变