Saturday, June 4, 2016

Why aren't my all `*.log` files committed into Git?

There's no entry like `*.log` in the `.gitignore` file of my project.

But I can't add `*.log` with the following message:

C:\Users\izeye\IdeaProjects\test>git addsrc\test\resources\test.log
The following paths are ignored by one of your .gitignore files:
src\test\resources\test.log
Use -f if you really want to add them.
fatal: no files added

C:\Users\izeye\IdeaProjects\test>

I can add it forcefully:

C:\Users\izeye\IdeaProjects\test>git add src\test\resources\test.log -f
warning: LF will be replaced by CRLF in src/test/resources/test.log.
The file will have its original line endings in your working directory.

C:\Users\izeye\IdeaProjects\test>

but why?

Finally I found the following configuration in `.gitconfig`:

[core]
autocrlf = true
excludesfile = C:\\Users\\izeye\\Documents\\gitignore_global.txt

and `gitignore_global.txt` has the following configuration:

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.dll
*.lib
*.sbr

That's why I can't add `*.log`.

No comments:

Post a Comment