Search code examples
gitgitignore

.gitignore not ignoring filenames with spaces in them on `git status`


When I do a git status I get:

#       modified:   COM/config/Config/Edit Project Settings.lnk

But in my .gitignore I have:

*.lnk

What is going on here? Could it be a problem with whitespaces?


Solution

  • Ok so my problem actually was that the files where already in the repository, so adding the pattern to .gitignore did not prevent git from tracking changes on them.

    What was needed was

    git update-index --assume-unchanged <file>

    Now their changes are not tracked anymore.

    Else as ansh0l pointed out git handles spaces perfectly fine.