Published in


Git: File Diff Even When just Clone or Pull

This is a confusing issue when there is a file diff after just cloning or pulling the existing project.

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: file_name.extension

But wait, I’ve did anything. Why do I have this?

It’s about git config

For example:

(1) Almost all file modified.

If you’re in Window machine, it’s likely that the line conversion make such diff or file mode. I wrote it here.
git config core.autocrlf true
git config core.filemode true

(2) Mysterious file diff that cannot be add or remove.

It is in my case here, that there is two file in same name but one lowercase and another uppercase.

$ git checkout -- filename
// doesn't work
$ git add filename
// doesn't work
$ rm filename
// doesn't work

All of above doesn’t make it goes away. This is also due to git config.
git config core.ignorecase true

Other uncommon error

You can see all list of possible local machine config with this command

core.autocrlf=true core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true core.ignorecase=true

You see the two cases above is also due to this following config. So if there is anything go wrong, check here to see the complete config list.

Web Application | Software | IoT



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store