2016-09-26 6 views
-1

何らかの理由で私が元に戻せないローカルの変更が表示されているgitリポジトリがあります。たてのクローン化されたレポから私はGitの差分から次の差分で1つのコンフィギュレーションファイルの変更を参照してくださいローカル変更がgitリセットによって削除されないのはなぜですか?

C:\Projects\NewUI>git diff 
diff --git a/EPFR.CountryFlows.Tests/app.config b/EPFR.CountryFlows.Tests/app.config 
index d7256aa..7e1d79c 100644 
--- a/EPFR.CountryFlows.Tests/app.config 
+++ b/EPFR.CountryFlows.Tests/app.config 
@@ -1,11 +1,17 @@ 
<U+FEFF><?xml version="1.0" encoding="utf-8"?> 
<configuration> 
- <runtime> 
- <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
-  <dependentAssembly> 
-  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
-  <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> 
-  </dependentAssembly> 
- </assemblyBinding> 
- </runtime> 
+ <configSections> 
+ <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
+ <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
+ </configSections> 
+ <entityFramework> 
+ <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
+  <parameters> 
+  <parameter value="mssqllocaldb" /> 
+  </parameters> 
+ </defaultConnectionFactory> 
+ <providers> 
+  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
+ </providers> 
+ </entityFramework> 
</configuration> 
\ No newline at end of file 

私はgit resetまたはgit checkoutを実行すると、何も変わりません。私は私が追加された線、および削除された行を切り替えていることを示している以下のような結果

C:\Projects\NewUI>git diff 
diff --git a/EPFR.CountryFlows.Tests/App.config b/EPFR.CountryFlows.Tests/App.config 
index 7e1d79c..d7256aa 100644 
--- a/EPFR.CountryFlows.Tests/App.config 
+++ b/EPFR.CountryFlows.Tests/App.config 
@@ -1,17 +1,11 @@ 
<U+FEFF><?xml version="1.0" encoding="utf-8"?> 
<configuration> 
- <configSections> 
- <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
- <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
- </configSections> 
- <entityFramework> 
- <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
-  <parameters> 
-  <parameter value="mssqllocaldb" /> 
-  </parameters> 
- </defaultConnectionFactory> 
- <providers> 
-  <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> 
- </providers> 
- </entityFramework> 
+ <runtime> 
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> 
+  <dependentAssembly> 
+  <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" /> 
+  <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> 
+  </dependentAssembly> 
+ </assemblyBinding> 
+ </runtime> 
</configuration> 
\ No newline at end of file 

を取得run git reset --hard場合。 git reset --hardを実行すると、これら2つのセクションのコードが追加と削除の間で前後に切り替わります。私は間違って何をしていますか?ここで

+0

これは、リポジトリの新鮮なクローンの後で再びoccuringからの問題を回避するために、この質問

git mv -f app.config App.config git commit -m 'fix case' 

から、これに以下の答え、および修正を発見しました他のコマンドは実行されませんでしたか? – merlin2011

答えて

1

ある時点で誰かがapp.Configをコミットし、他の誰かが上記の出力で確認できるApp.configをコミットしていたことが判明しました。 Linuxは大文字と小文字を区別するファイルを持っているので、Gitはこれを処理できます私は、

git config core.ignorecase true 

Git status shows file twice but different case

1
git reset --hard HEAD^ 

HEAD - 私は現在で座っているコミット。 HEAD^- コミットの親です。これによりローカルでの変更が削除されます

+0

これはOPの問題をどのように説明していますか? – Leon

+0

git reset - 少なくとも現在のブランチ(HEAD)が指している場所を変更します。明示的に1つのコミットバックにヘッドを変更すると、ディレクトリが再びクリーンになります。変更は作業ツリーに残らないので、git statusコマンドを実行すると、リポジトリに変更がないことがわかります。 – Cyclotron3x3

+0

引数なしの 'git reset --hard'はHEADを変更しません。これは、作業ツリー内の索引および追跡されたファイルを、HEADに対応する状態にリセットするだけです。 'git reset -hard'を実行した後、diffの出力が交互になるのはどういう意味ですか? – Leon

関連する問題