Make .gitignore ignore everything except a few files

前端 未结 23 2923
无人共我
无人共我 2020-11-22 00:14

I understand that a .gitignore file cloaks specified files from Git\'s version control. I have a project (LaTeX) that generates lots of extra files (.auth, .dvi, .pdf, logs,

23条回答
  •  忘了有多久
    2020-11-22 00:57

    A little more specific:

    Example: Ignore everything in webroot/cache - but keep webroot/cache/.htaccess.

    Notice the slash (/) after the cache folder:

    FAILS

    webroot/cache*
    !webroot/cache/.htaccess
    

    WORKS

    webroot/cache/*
    !webroot/cache/.htaccess
    

提交回复
热议问题