2013-01-03 16 views
5

जब मैं 'Git स्थिति' करते हैं, मैंमैं 'प्रतिबद्धता के लिए चरणबद्ध नहीं किए गए परिवर्तन' को कैसे हटा सकता हूं? Git में

% git status 
# Not currently on any branch. 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
#  modified: Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
#  modified: Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops 

मिलता लेकिन उसके बाद मैंने किया '% Git चेकआउट - स्रोत/वेबकिट/जीत/WebKit.vcproj/WebKitApple.vsprops', मैं देखना वही:

% git checkout -- Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
% git status 
# Not currently on any branch. 
# Changes not staged for commit: 
# (use "git add <file>..." to update what will be committed) 
# (use "git checkout -- <file>..." to discard changes in working directory) 
# 
#  modified: Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
#  modified: Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops 
# 

मैं उन "परिवर्तनों के लिए चरणबद्ध नहीं किए गए परिवर्तन" को कैसे हटा सकता हूं?

मैंने 'गिट स्टैश' भी कोशिश की है, फिर भी कुछ लोग कैसे बदलते हैं।

मैंने एक 'गिट diff' किया है। और यह परिणाम है, मैं नहीं देख पा रहे^एम: और मैं '.gitconfig' पर ध्यान दिया है, मैं 'की जरूरत नहीं है autoctrl

% git diff  
diff --git a/Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops b/Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
index 2ea7a51..9643739 100644 
--- a/Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
+++ b/Source/WebKit/win/WebKit.vcproj/WebKitApple.vsprops 
@@ -1,12 +1,12 @@ 
-<?xml version="1.0" encoding="Windows-1252"?> 
-<VisualStudioPropertySheet 
- ProjectType="Visual C++" 
- Version="8.00" 
- Name="WebKitApple" 
- > 
- <Tool 
-   Name="VCLinkerTool" 
-   AdditionalDependencies="CFNetwork$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib QTMovieWin$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib" 
-   DelayLoadDLLs="QTMovieWin$(WebKitConfigSuffix).dll" 
- /> 
+<?xml version="1.0" encoding="Windows-1252"?> 
+<VisualStudioPropertySheet 
+  ProjectType="Visual C++" 
+  Version="8.00" 
+  Name="WebKitApple" 
+  > 
+  <Tool 
+    Name="VCLinkerTool" 
+    AdditionalDependencies="CFNetwork$(LibraryConfigSuffix).lib CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib QTMovieWin$(WebKitConfigSuffix).lib WebKitSystemInterface$(WebKitConfigSuffix).lib" 
+    DelayLoadDLLs="QTMovieWin$(WebKitConfigSuffix).dll" 
+  /> 
</VisualStudioPropertySheet> 
\ No newline at end of file 
diff --git a/Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops b/Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops 
index 797b4cb..c95c87d 100644 
--- a/Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops 
+++ b/Source/WebKit/win/WebKit.vcproj/WebKitDirectX.vsprops 
@@ -1,15 +1,15 @@ 
-<?xml version="1.0" encoding="Windows-1252"?> 
-<VisualStudioPropertySheet 
- ProjectType="Visual C++" 
- Version="8.00" 
- Name="WebKitDirectX" 
- > 
- <Tool 
-   Name="VCCLCompilerTool" 
-   AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)\Include&quot;" 
- /> 
- <Tool 
-   Name="VCLinkerTool" 
-   AdditionalLibraryDirectories="$(DXSDK_DIR)\Lib\x86" 
- /> 
+<?xml version="1.0" encoding="Windows-1252"?> 
+<VisualStudioPropertySheet 
+  ProjectType="Visual C++" 
+  Version="8.00" 
+  Name="WebKitDirectX" 
+  > 
+ <Tool 
+    Name="VCCLCompilerTool" 
+    AdditionalIncludeDirectories="&quot;$(DXSDK_DIR)\Include&quot;" 
+  /> 
+ <Tool 
+    Name="VCLinkerTool" 
+    AdditionalLibraryDirectories="$(DXSDK_DIR)\Lib\x86" 
+  /> 
</VisualStudioPropertySheet> 
\ No newline at end of file 
+0

क्या आपके पास विजुअल स्टूडियो खुला है तुम इसे करो? यदि नहीं, तो कृपया वीएस बंद करें और चेकआउट/स्टेटस कमांड को फिर से प्रयास करें। मैं सोच रहा हूं कि वीएस पढ़ रहा है और फिर फ़ाइल को फिर से लिखना जैसे ही यह नोटिस करता है कि इसे संशोधित किया गया था। – cdhowie

उत्तर

8

ऐसा लगता है आप core.autocrlf विकल्प का उपयोग कर रहे हैं। संभवतः क्या हो रहा है कि भंडार में फ़ाइल में सीआरएलएफ लाइन के अंत होते हैं, लेकिन इस विकल्प को सेट करने के कारण, गिट सोचता है कि फ़ाइल में भंडार में एलएफ लाइन समाप्ति होनी चाहिए। जब आप फ़ाइल को चेकआउट करते हैं, तो आपको अपनी कार्यशील निर्देशिका में फ़ाइल प्लेटफ़ॉर्म-मूल रेखा समाप्ति के साथ मिल रही है (यदि Windows पर CRLF, यूनिक्स पर एलएफ, आदि)।

git status ऑपरेशन के हिस्से के रूप में, गिट उनको वापस एलएफ में परिवर्तित कर रहा है। यदि सीआईडीएफ समापन के रूप में गिट में हेड संशोधन में फ़ाइल संग्रहीत की जाती है, तो यह बताएगा कि गिट अभी भी दो संस्करणों को अलग-अलग क्यों देखता है, यहां तक ​​कि आप इंडेक्स से संशोधन की जांच करने के बाद भी।

यह पता लगाने का सबसे सरल तरीका टर्मिनल से git diff चलाने के लिए है, जो आपको सीआर चरित्र ^M के रूप में दिखाएगा।

इस स्थिति को हल करने के लिए आपको सिर्फ फाइलों (जैसे "लाइन अंत मानकीकरण" कुछ संदेश के साथ) के लिए प्रतिबद्ध सकते हैं या आप core.autocrlf पूरी तरह से निष्क्रिय कर सकते हैं, जिसका मतलब है कि फ़ाइलें भंडार में संग्रहीत किया जाएगा और पंक्ति के रूप में-है समापन समायोजन गिट द्वारा नहीं किया जाएगा। (यदि आप अन्य प्लेटफॉर्म का उपयोग नहीं करते हैं, तो इसका बहुत नकारात्मक परिणाम हो सकते हैं।)

2

मैं सिर्फ @cdhowie के उत्तर में जोड़ना चाहता हूं।

मुझे ओपी के समान समस्या का अनुभव हुआ।

od -xcb foo.txt | tail 

विंडोज लाइन अंत इस तरह दिखना चाहिए:

\r \n 

आसानी से सभी प्रभावित फ़ाइलें प्राप्त करने के लिए और

खिड़कियों लाइन अंत सत्यापित करने के लिए सबसे अच्छा तरीका है vim के माध्यम से लेकिन od के माध्यम से नहीं है यूनिक्स में परिवर्तित करें (मेरे मामले में) यह करना है:

git ls-files -m | xargs dos2unix 
dos2unix: converting file foo.txt to Unix format ... 
dos2unix: converting file moo.txt to Unix format ... 
+0

'git ls-files -m | xargs dos2unix' बहुत उपयोगी है। –

संबंधित मुद्दे

 संबंधित मुद्दे