我正在尝试从命令行合并合并请求(Gitlab)。
在使用虚拟存储库后,我知道如果我有权合并合并请求,则可以直接通过命令行合并它们。
我从克隆本地系统中的上游存储库开始。之后,我在派生的存储库中进行了更改,并为此创建了合并请求。
当使用这种方法手动尝试从命令行合并请求时,我得到了一个额外的提交,即合并提交(--no-ff)。
git fetch <Fork_Repo_URL> <Fork_Repo_Branch>
git checkout -b <Branch_Name> FETCH_HEAD
git fetch origin
git checkout origin/master
git merge --no-ff <Remote_Name>-<Branch_Name>
git push origin master
注意:以上命令是从克隆的上游存储库中使用的。
现在,我想执行同样的操作而不克隆上游存储库,而只是将上游远程添加到我的派生存储库中。
我遵循了gitlab文档中提到的所有手动合并请求的步骤,但是令我惊讶的是,尽管合并请求是在使用这些命令后合并的,但是我看不到任何合并提交。
git remote add central <Central_Repo_URL>
git fetch origin master
git checkout -b my_master FETCH_HEAD
git fetch central
git checkout central/master
git merge --no-ff my_master-master
git push central master
那么,是否有任何方法可以通过在派生的存储库中配置远程来合并合并请求(我有权限),以及生成合并提交吗?
我也尝试过这种方式。
git fetch central
git checkout central/master
git merge --no-ff origin/master
git push central master
我也尝试过提交修改,重新设置基准。
我已经从上面torek的评论中找到了解决方案。实际上是在做
git checkout central/master
我要转到一个分离的HEAD,退出节点时,此模式下的所有提交都将丢失。
因此最好的解决方案应该是创建一个本地分支,该分支可以跟踪名为Central / master的上游远程服务器。(请忽略我的分支名称)
git checkout -b centralMaster central/master
现在,在完成上述所有步骤之后,我们可以轻松解决此问题,并且也无需进行快速前向合并提交。
git checkout -b centralMaster central/master
git fetch central
git fetch origin
git merge origin/falcondev --no-ff -m "<Message>"
git push central centralMaster:master
现在,上述所有问题都可以轻松解决。
如果我在这些步骤上有任何错误,请发表评论。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句