0

我有 4 个提交要合并为一个。以下是之后出现的内容rebase -i

pick 43b00e2 test2
pick f046962 Fixed files refreshing forever when list is empty
pick 92788fb Fixed files refreshing forever when list is empty
pick aef642a fuckgit

当我将其更改为:

pick 43b00e2 test2
squash f046962 Fixed files refreshing forever when list is empty
squash 92788fb Fixed files refreshing forever when list is empty
squash aef642a fuckgit

我明白了:

D:\Users\Steven\Documents\projects2\Put.io [master]> git rebase -i
warning: LF will be replaced by CRLF in res/drawable/btn_check_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/edit_text_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/putio_clickable_button.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/btn_check_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/edit_text_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/putio_clickable_button.xml.
The file will have its original line endings in your working directory.
error: could not apply 43b00e2... test2

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".
warning: LF will be replaced by CRLF in project.properties.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/btn_check_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/edit_text_putio.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in res/drawable/putio_clickable_button.xml.
The file will have its original line endings in your working directory.
Could not apply 43b00e2... test2

这是什么意思,我怎样才能正确地压缩这些提交?

4

1 回答 1

1

这就是臭名昭著的 CR/LF 问题。

Git 的最佳 CRLF(回车、换行)处理策略是什么?

怎么修?好吧,这取决于您的平台。你必须告诉 git 如何处理行尾。

您可能需要从文件中剥离 LF 并将它们提交回 git。这篇文章为您的问题提供了解决方案。关键是.. 由于您想压缩提交,因此您需要在上述 rebase 步骤中应用修复。

于 2012-10-24T03:47:49.913 回答