Halaman

Senin, 18 Agustus 2014

Solving Git always shows modified files even if they are not modified

Sometime when working on multiple environment(Windows, *nix), the new line character at the end is not visible to the human eye, but even if that is not visible, versioning system such as git will treat them as modifications.

When installing Git on windows machine, we usually press the "next" button rapidly that we are not aware that we are telling the Git to add automated "crlf" or "lf" to each line of the checked-out source code. The symptom such as :
  1. Always shows modified files even if we are not changing a particular file
  2. Even after revert or a hard --reset the modified files is showing
To remedy the situation use the following command in sequence:
  1. git config --global core.autocrlf false
  2. git reset --hard
  3. git status
The list of modified files which we are not modify should be gone now. 

Cheers! ;)