I have a very simple C# program which iterates over a number of files and replaces a string in all the files.
However, when I compare these files using Git, it highlights a change to all my files.
My C# code is:
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
foreach (string file in files)
{
string fileText = File.ReadAllText(fileName, Encoding.UTF8);
string newText = fileText.Replace("hello", "goodbye");
File.WriteAllText(fileName, newText, Encoding.UTF8);
}
Which as far as I'm concerned, looks good.
However, when I run this program and execute git status
on the repository, I see differences in every file.
Using a program like Github Desktop or SourceTree reveals the following changes:
Github Desktop
Sourcetree
Thank you for any tips or ideas anyone may have. They're greatly appreciated. :)