Hice un cambio en un par de files localmente, sin comprometerlos . git status
muestra:
>> 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")
Quiero descartar los cambios en esos files. Traté de seguir las instrucciones:
>> git checkout -- .\source\Octopus.Tentacle\Integration\PowerShell\IPowerShell.cs
El command no tiene salida. Ahora ejecuto el git status
nuevamente:
>> 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, está bastante convencido de que el file ha cambiado. Y git diff <file>
parece pensar que todo el file ha cambiado, aunque no ha cambiado:
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
¿Cómo convenzo a git de que realmente, realmente no he cambiado el file y no quiero comprometerlo?
Editar : los siguientes commands tampoco tienen efecto sobre estas modificaciones:
git checkout -- .
git checkout -f
git reset --soft
git reset --hard
Editar 2 : volviendo a una revisión anterior, ocultando mis cambios, luego borrando el alijo eventualmente funcionó. Parece que mis finales de línea son conflictivos, pero no sé por qué:
core.autocrlf
configurado en true .gitattributes
con el *.cs text
la línea *.cs text
¿No debería ser esto suficiente?
Tenía un core.autocrlf es falso, pero recientemente cambió a verdadero y también aplica cambios de gitattributes para .net. Después de eso, en muchos repositorys, cuando tratas de tirar, comencé a recibir informes sobre los cambios que no existen y que tampoco se pueden revertir. Al final, volví a core.autocrlf es falso