2010-02-24 2 views
5

Я использую git (с git-svn) на linux, а коллега использует svn на окнах.git svn windows linux проблемы с пробелами

Так много раз, git сообщает о проблемах с пробелами. На самом деле из-за этих проблем он не может выполнить линейную историю и создает конфликты слияния.

Каков самый простой способ настройки svn/git и git-svn на windows и linux, чтобы теперь возникали проблемы с пробелами?

Ниже приводится сообщили слияния конфликта, в линейной истории на мастере:

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". 

Как решить проблемы пробельных?

ответ

11

Фиксирующие пробельные ошибки

Добавить это .gitconfig

[core] 
    whitespace=nowarn 

мерзавца Rebase должен теперь работать. (При желании вы можете добавить некоторые из fix,-indent-with-non-tab,trailing-space того, чтобы мерзавец исправить все непечатаемые при каждой фиксации. Независимо от того, что это хорошая идея, зависит от ваших правил проекта и команды.)

Исправление ошибок EOL

[core] 
    autocrlf = true 

в вашем .gitconfig. Это заставит каждый текстовый файл иметь окончание строк Windows. svn по умолчанию игнорирует окончания строк, и если ваши текстовые редакторы на окнах нормальны, вы можете оставить его таким образом. В противном случае добавьте this file в конфигурацию svn (необязательно, сменив native на CRLF), обеспечив согласование концов линии CRLF.

Установить autocrlf = input и обмениваться native на LF для последовательного окончания строки linux.

Смежные вопросы