git - '你的分支在 'origin/remote-branch' 之前 37 提交。' 合并后
问题描述
我已经完成了以下步骤:
>git checkout remote-branch-test
>git pull
>git checkout remote-branch
>git pull
>git merge remote-branch-test
Automatic merge failed; fix conflicts and then commit the result.
解决了冲突
>git add .
>git commit
>git push origin remote-branch
**! [remote rejected] remote-branch -> remote-branch (you are not allowed to upload merges)
error: failed to push some refs to ....
当我在远程服务器上执行 git status 时
>git status
On branch remote-branch
Your branch is ahead of 'origin/remote-branch' by 37 commits.
(use "git push" to publish your local commits)
我无法将更改推送到远程
我在这里想念什么?
解决方案
这里有几点需要注意。 博士指出最重要的:
[remote rejected] ... you are not allowed to upload merges
这告诉我们,你的“远程”——你发送提交的另一个 Git——只是禁止所有合并提交,句号。
但是,该特定错误消息不是来自 Git 或 GitHub,而是来自Gerrit。例如,即使我允许“推送合并提交”,请参阅Gerrit:远程拒绝(您不允许上传合并)。这意味着您没有使用 GitHub 进行推送。因此github标签可能是不合适的。而且,由于 Gerrit 在 Git 上添加了自己的东西层,因此git标签也可能不合适。我在这里添加了gerrit,但您应该确保这些是正确的标签并删除任何不合适的标签。
最后,合并添加许多提交是正常的:合并提交有两个父级,因此向某个分支B添加一个合并提交通常会将 N+1 提交添加到B,其中N是从提交到达的提交数在合并之前合并但不是从B本身合并。因此,您的合并合并了现有的 36 个提交,加上合并本身,总共 37 个提交。
推荐阅读
- javascript - 如何仅访问具有相同类的特定元素?jQuery
- jupyter-notebook - 如何解决 juypter notebook 中的内核重启错误?
- navigation - 水平滚动导航 - onclick 正确的项目不活动
- python - 尝试导入 matplotlib 时没有名为“kiwisolver”的模块
- cassandra - Cassandra错误无法连接到任何服务器',{'*':错误(111,“尝试连接到[('*',9042)]。最后一个错误:连接被拒绝
- php - 无法删除某些PC的某些浏览器上的cookie
- json - parseJSON通用函数怎么写?迅速
- variables - 使用 fastcgi_cache,如何避免缓存 $request_id 变量
- c# - Portaudio 打开流但根本没有声音
- expect - 期望脚本来配置 PDU