search

Home  >  Q&A  >  body text

in .gitignore! Why does the configuration item not work?


I want the /public/examples/images/ directory not to be ignored, but this configuration does not work!

According to logic, it should be reasonable, because the /public/examples/ directory has been ignored before, then the directories below it must be ignored.

But after looking for an introduction to the configuration items of .gitignore, I found that my configuration method was not wrong! This is very sad and I don't understand why it doesn't work. . .

大家讲道理大家讲道理2807 days ago782

reply all(2)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:45:04

    This is specifically explained in the gitignore manual. If a parent directory has been set to not be included, then its subdirectories cannot be reused and included. !

    An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded.

    reply
    0
  • 阿神

    阿神2017-05-02 09:45:04

    It may be because you have added this directory to git, and then writing gitignore does not work. Use git rm to delete the unwanted paths in git, and then take a look and it should be fine
    It seems that gitignore cannot block files or paths that have been added to git.

    reply
    0
  • Cancelreply