0

Gitは同じチェンジセットを追加し続けます。これは次のようになります。

@@ -1,12 +1,12 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
-    android:orientation="vertical" >
-
-    <TextView
-        android:layout_width="fill_parent"
-        android:layout_height="wrap_content"
-       android:text="@string/hello" />
-
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <TextView
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:text="@string/hello" />
+
 </LinearLayout>
\ No newline at end of file

ファイルはどのエディターでも開かれていません。またはを実行するか、githubツールを使用して変更を破棄するたびに、git checkout何もしなくても変更が再表示されます。ファイルをコミットしても何も変更されず、同じチェンジセットがすぐに再表示されます。

どうすればこれを防ぐことができますか?

4

1 に答える 1

0

ファイル全体が常に変更されますか?行末!改行として読んでください!!!)

行末変換に関するgitのマニュアル、Githubもこれに関する詳細な説明として読むことができますが、基本的には次のようになります。

  • エディターは予想される行末を使用する必要があります(ほとんどの人はOSのデフォルトを使用します)
  • gitconfigのcore.autocrlfは、エディターのオプションに従う必要があります。

間違った行末でコミットした場合は、行の問題を修正するコミットを発行する必要がある場合があります(つまり、gitリポジトリは常にLFにある必要があります)。

于 2012-06-05T12:25:45.443 に答える