git svn windows linux空白问题

Lak*_*sad 5 svn git version-control git-svn

我在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".
Run Code Online (Sandbox Code Playgroud)

我如何解决空白问题?

ans*_*hul 11

修复空白错误

将此添加到 .gitconfig

[core]
  whitespace=nowarn
Run Code Online (Sandbox Code Playgroud)

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

修复eol错误

[core]
  autocrlf = true
Run Code Online (Sandbox Code Playgroud)

在你的.gitconfig.这将强制每个文本文件具有窗口行结尾. svn默认情况下忽略行结尾,如果Windows上的文本编辑器是理智的,你可以这样做.否则,将此文件添加到您的svn配置(可选择更改nativeCRLF),以确保一致的CRLF行结束.

设置autocrlf = input和更改native,以 LF在整个持续linux行的结尾.