首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >git svn windows linux空格问题

git svn windows linux空格问题
EN

Stack Overflow用户
提问于 2010-02-25 01:10:20
回答 1查看 4.3K关注 0票数 5

我在linux上使用git (带有git- svn ),一个同事在windows上使用svn。

很多时候,git都会报告空格问题。事实上,由于这些问题,它无法提交线性历史,并造成合并冲突。

在windows和linux上配置svn/git和git-svn的最简单方法是什么,以便现在有空格问题?

以下是master上的线性历史记录中报告的合并冲突:

代码语言:javascript
运行
复制
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".

如何解决空格问题?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-02-25 01:33:25

修复空格错误

将此内容添加到.gitconfig

代码语言:javascript
运行
复制
[core]
  whitespace=nowarn

git rebase现在应该可以工作了。(您可以选择向其中添加一些fix,-indent-with-non-tab,trailing-space,以便让git在每次提交时修复所有空格。这是不是一个好主意取决于你的项目规则和团队。)

修复停产错误

代码语言:javascript
运行
复制
[core]
  autocrlf = true

在你的.gitconfig里。这将强制每个文本文件都有windows行结尾。默认情况下,svn会忽略行结束符,如果你在windows上的文本编辑器是正常的,你可以让它保持原样。否则,将this file添加到您的svn配置中(可以选择将native更改为CRLF),以确保从输出到输出的一致的CRLF行结尾。

设置autocrlf = input并将native更改为LF,以便始终保持一致的Linux行结尾。

票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2327917

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档