I have a repository cloned from GitHub, and I made changes to file A, however Git is detecting
changes to file B,C and D. All three files are detecting the changes as basically the entire contents of B,C,D. i.e. +all lines in B,C,D, -all lines in B,C,D.
I don’t want to commit this as it makes for a dirty commit. Why is git detecting these changes and how to I get git to ignore these changes forever?
The project is in C#, I use the GitHub windows application and the IDE is VS Express 2012.
Edit:
I realize the files have changed, but is there a way to a) find out what changed and b) tell git to ignore them and not pick them up again between commits. It seems my editor is modifying files B,C,D in some way after I first openened the cloned project.
Even after running a git reset –hard, git diff still reports the changes.
You probably need to tell git about your line ending strategy.
See the following resources for more information on this subject
Note: Short time fix would require to tweak the
core.autocrlfsetting on your computer. The correct fix would be to create a.gitattributesfiles, commit it, and send a Pull Request to the upstream repository you’ve cloned. Indeed, it would not only fix your issue, but would also prevent new users from stumbling on the same problem later.An example of a valid, C# project compatible, cross platform
.gitattributesfile can be found here. Feel free to get some inspiration from it 😉A very detailed blog post about line endings and Git inner workings is Mind the end of your line. It’s very well worth the read.