English 中文(简体)
为什么Gite坚持甚至在“检查后”修改档案?
原标题:Why does Git insist that a file has been modified even after a `git checkout --`?

我对当地几个档案做了改动,没有承诺<>。 www.un.org/Depts/DGACM/index_spanish.htm

>> 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 -- .sourceOctopus.TentacleIntegrationPowerShellIPowerShell.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")

Hmm, it s pretty convinced that the file has changed. And git diff <file> seems to think that the whole file has changed, even though it hasn t:

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

我怎么能说服我真的说,我真的没有改变档案,不想这样做?

www.un.org/Depts/DGACM/index_russian.htm

  • git checkout -- .
  • git checkout -f
  • git reset --soft
  • git reset --hard

Edit 2: Reverting back to an older revision, stashing my changes, then clearing the stash eventually worked. It seems like my line endings are conflicting but I don t know why:

  • I have core.autocrlf set to true
  • I have a .gitattributes file with the line *.cs text

这是否足够?

最佳回答

我有一个核心。 汽车价格是假的,但最近又变成了真的,并且对蚊帐也进行了变换。 之后,在很多仓库里,当你试图撤离时,我开始收到关于不存在变化的报告,也未能退缩。 最后,我回到了核心位置。 汽车价格假

问题回答

暂无回答




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...