git rebase错误(" could not apply ...") [英] Error with git rebase ("could not apply...")

查看:1497
本文介绍了git rebase错误(" could not apply ...")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是GitHub存储库的管理员 https://github.com/plison/opendial 。我想减少存储库上的提交次数,因为存储库已经有几千次提交,其中许多是轻微的调试更改,可能很容易被压缩在一起(尤其是几年前的更改)。 p>

因此,我试图应用重新绑定来压缩部分提交。不过,我遇到以下问题:


  1. 当我输入 git rebase -i HEAD〜10 ,我在交互式编辑器中获得了相当长的提交行数(超过10个)。可能是什么原因?
  2. 更重要的是,一旦我关闭了交互式编辑器以启动重新绑定,我就会系统地收到错误消息error:could not apply,我不会对提交进行任何更改(即,如果我将所有行保留为选择,而不进行任何修改或重新排序)。

如何解决这些问题?应该指出的是,存储库是从谷歌代码上托管的以前的(SVN)存储库中自动导入的。转换似乎到目前为止运行良好,但我想知道为什么我试图重新绑定我的提交时遇到这些错误。

解决方案

您的项目历史似乎最近包含一些合并提交(大概你创造了这些)。在你想交互重新分配的地方提交merge merge通常会导致问题(交互式重新分配几乎假设线性历史记录,但合并提交不是线性的。)



您的项目历史记录似乎有两个并行历史记录,它们在提交11b3653中合并在一起(使用像 gitk 或者 tig 来看看这个,它在Github的web界面上没有很好的显示)。



我建议您先尝试平滑历史记录以摆脱并行历史记录,并删除合并提交。然后,一旦你有一个严格的线性历史,你可以设置重写历史记录,以消除所有的调试流失。


I'm the administrator of the GitHub repository https://github.com/plison/opendial. I would like to reduce the number of commits on the repository, since the repository already has a few thousand commits, many of whom are minor debugging changes that could easily be squashed together (especially the ones that are a few years old).

I'm therefore trying to apply rebasing in order to squash together part of my commits. However, I've experience the following issue:

  1. When I type e.g. git rebase -i HEAD~10, I get a quite long number of commit lines (much more than 10) in the interactive editor. What could be the reason?
  2. More importantly, once I close the interactive editor to start the rebasing, I systematically get the error message "error:could not apply ', even when I do not make any change to the commits (i.e. if I leave all lines as 'pick', without any modification or reordering).

How can I solve these issues? It should be noted that the repository was automatically imported from a previous (SVN) repository hosted on Google Code. The conversion seemed so far to have worked well, but I'm wondering why I get these errors when trying to rebase my commits.

解决方案

The history of your project seems to contain a number of merge commits recently (presumably you made those). The presence of merge commits in what you want to interactively rebase usually causes problems. (An interactive rebase pretty much assumes a linear history, but merge commits are not linear.)

Your project history also somehow seems to have two parallel histories that are merged together in commit 11b3653 (use a tool like gitk or tig to see this, it's not shown well on Github's web interface).

I would suggest that you attempt to first flatten your history to get rid of the parallel histories, and to remove the merge commits. Then, once you have a strictly linear history, you can set about rewriting the history to remove all the debugging churn.

这篇关于git rebase错误(" could not apply ...")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆