いくつかのファイルをコミットせずに、ローカルで変更しました。git status
ショー:
>> git status
# On branch feature-ravendb
# Your branch is ahead of 'origin/feature-ravendb' by 1 commit.
#
# 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/Octopus.Tentacle/Integration/PowerShell/IPowerShell.cs
# modified: source/Octopus.Tentacle/Integration/PowerShell/PowerShellRunner.cs
#
no changes added to commit (use "git add" and/or "git commit -a")
それらのファイルへの変更を破棄したいと思います。私は指示に従ってみました:
>> git checkout -- .\source\Octopus.Tentacle\Integration\PowerShell\IPowerShell.cs
コマンドには出力がありません。今、私はgit status
再び走ります:
>> git status
# On branch feature-ravendb
# Your branch is ahead of 'origin/feature-ravendb' by 1 commit.
#
# 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/Octopus.Tentacle/Integration/PowerShell/IPowerShell.cs
# modified: source/Octopus.Tentacle/Integration/PowerShell/PowerShellRunner.c
#
no changes added to commit (use "git add" and/or "git commit -a")
うーん、ファイルが変更されたとかなり確信しています。そしてgit diff <file>
、ファイル全体が変更されたとは思わないようですが、変更されていません。
diff --git a/source/Octopus.Tentacle/Integration/PowerShell/IPowerShell.cs b/source/Octo
--- a/source/Octopus.Tentacle/Integration/PowerShell/IPowerShell.cs
+++ b/source/Octopus.Tentacle/Integration/PowerShell/IPowerShell.cs
@@ -1,9 +1,9 @@
-<EF><BB><BF>using System;
-
-namespace Octopus.Tentacle.Integration.PowerShell
-{
- public interface IPowerShell
- {
- PowerShellExecutionResult Execute(PowerShellArguments arguments);
- }
+<EF><BB><BF>using System;
+
+namespace Octopus.Tentacle.Integration.PowerShell
+{
+ public interface IPowerShell
+ {
+ PowerShellExecutionResult Execute(PowerShellArguments arguments);
+ }
}
\ No newline at end of file
本当に、本当にファイルを変更しておらず、コミットしたくないことをgitに納得させるにはどうすればよいですか?
編集:次のコマンドもこれらの変更には影響しません。
git checkout -- .
git checkout -f
git reset --soft
git reset --hard
編集2:以前のリビジョンに戻し、変更を隠してから、隠しをクリアすると、最終的には機能しました。行末が矛盾しているようですが、理由はわかりません。
- 私は
core.autocrlf
trueに設定しました - 次
.gitattributes
の行のファイルがあります*.cs text
これで十分ではないですか?