我在linux上使用git (带有git- svn ),一个同事在windows上使用svn。
很多时候,git都会报告空格问题。事实上,由于这些问题,它无法提交线性历史,并造成合并冲突。
在windows和linux上配置svn/git和git-svn的最简单方法是什么,以便现在有空格问题?
以下是master上的线性历史记录中报告的合并冲突:
error: patch failed: frontend/templates/frontend/base.html:38
error: frontend/templates/frontend/base.html: patch does not apply
error: patch failed: frontend/templates/frontend/footer.html:1
error: frontend/templates/frontend/footer.html: patch does not apply
error: patch failed: frontend/templates/frontend/index.html:1
error: frontend/templates/frontend/index.html: patch does not apply
Using index info to reconstruct a base tree...
<stdin>:15: trailing whitespace.
<stdin>:20: trailing whitespace.
<a href="{% url frontend_index %}">
<stdin>:22: trailing whitespace.
</a>
<stdin>:24: trailing whitespace.
<span class="companyname">
<stdin>:25: trailing whitespace.
<a href="{% url frontend_index %}">
warning: squelched 74 whitespace errors
warning: 79 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging frontend/templates/frontend/base.html
CONFLICT (content): Merge conflict in frontend/templates/frontend/base.html
Auto-merging frontend/templates/frontend/index.html
CONFLICT (content): Merge conflict in frontend/templates/frontend/index.html
Failed to merge in the changes.
Patch failed at 0001 template changes
When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".
如何解决空格问题?
发布于 2010-02-25 01:33:25
修复空格错误
将此内容添加到.gitconfig
[core]
whitespace=nowarn
git rebase现在应该可以工作了。(您可以选择向其中添加一些fix,-indent-with-non-tab,trailing-space
,以便让git在每次提交时修复所有空格。这是不是一个好主意取决于你的项目规则和团队。)
修复停产错误
[core]
autocrlf = true
在你的.gitconfig
里。这将强制每个文本文件都有windows行结尾。默认情况下,svn
会忽略行结束符,如果你在windows上的文本编辑器是正常的,你可以让它保持原样。否则,将this file添加到您的svn配置中(可以选择将native
更改为CRLF
),以确保从输出到输出的一致的CRLF行结尾。
设置autocrlf = input
并将native
更改为LF
,以便始终保持一致的Linux行结尾。
https://stackoverflow.com/questions/2327917
复制相似问题