2013-02-21 115 views
1

我最近有一個問題,因爲頭部和這些文件,git無法合併。 (Netbeans說)在Windows和Mac之間共享文件的git錯誤

所以我試着用Git Bash做它,它給了我關於.DS_Store的一些錯誤。所以我刪除了這些文件,現在當我嘗試合併時,幾乎所有文件都具有「兩個修改」文本,即使它們看起來完全相同。

@@@ -1,10 -1,10 +1,22 @@@ 
-<html> 

-<head> 

- <title>403 Forbidden</title> 

-</head> 

-<body> 

- 

-<p>Directory access is forbidden.</p> 

- 

-</body> 

    <<<<<<< HEAD 
+<html> 
+<head> 
+ <title>403 Forbidden</title> 
+</head> 
+<body> 
+ 
+<p>Directory access is forbidden.</p> 
+ 
+</body> 
    ======= 
++<html> 
++<head> 
++ <title>403 Forbidden</title> 
++</head> 
++<body> 
++ 
++<p>Directory access is forbidden.</p> 
++ 
++</body> 
    >>>>>>> 4dd01fd4 
    </html> 

但它似乎是增加了一個額外的意圖?

我該如何解決這個問題?

回答

3

我認爲這是由於文件中不同的行尾(回車(\ r)/換行符(\ n))。檢查它們是否一致。

我認爲舊文件已保存在Windows(\ r \ n)下。

+0

是的,我們是一些開發者,一些在Mac上,一些在Windows上。有什麼想法? :) – Muqito 2013-02-21 16:34:00

+3

最好是你設置你的編輯使用相同的行結束。或者你可以讓git爲你管理它們:https://help.github.com/articles/dealing-with-line-endings – weitho 2013-02-21 16:38:36

+0

我無法得到這個工作:(我試圖在netbeans中設置它和git bash – Muqito 2013-02-21 17:29:12