删除旧的提交:`git rebase`导致合并冲突 [英] Drop old commit: `git rebase` causes merge conflicts
问题描述
我一直试图达到1小时,但未能得到它。我发现的最好的命令是:
$ b $ pre $ git rebase --interactive --preserve-merges $(EVIL_COMMIT)^
,并在编辑器中注释掉第一个提交的是邪恶的提交。
不幸的是,在合并时会停止 git rebase
,并提示手动解决合并冲突。邪恶的提交只会增加一些我们的软件为测试目的计算的示例文件。因此,他们不应该与仅仅缺少示例文件发生冲突。
- 我不明白合并冲突来自哪里。有人可以解释吗?
- 如何解决这个问题?
我花了很多时间在Google和SO搜索。有些主题涉及类似的主题,但今天的使用的语法不可用 Git版本,或者它不适用于我(我只描述了上面的一种方法,因为它是最简单的方法)。 解决方案
我会用 filter-branch
:
git filter-branch --prune-empty --index-filter'
git rm --cached --ignore -unmatch path / to / file
'--all
Unfortunately we accidently checked in a large binary file some time ago and until today nobody noticed. Now I want to drop that commit and have the remaining history as it is. I know about the caveats of changing pushed history but in this case I cannot avoid it.
I have been trying to achieve that for ~1h but fail to get it. The best command I found is
git rebase --interactive --preserve-merges $(EVIL_COMMIT)^
and in the editor commenting out the 1st commit which is the evil one.
Unfortunately git rebase
stops at merges and prompts for manual resolution of merge conflicts. The evil commit only adds some example files our software shall compute for testing purposes. Thus their shouldn't be any conflict with the example files just missing.
- I do not understand where the merge conflicts originate from. Somebody can explain?
- How to resolve that?
I've spent quite a lot of time at Google and SO search. Some threads cover a similar topic but either syntax used is not available in today's Git version anymore or it didn't work for me (I only described one method above because it's the easiest approach).
I'd go with filter-branch
:
git filter-branch --prune-empty --index-filter '
git rm --cached --ignore-unmatch path/to/file
' --all
这篇关于删除旧的提交:`git rebase`导致合并冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!