简体   繁体   中英

How can I ignore everything except two directories (nested)?

Here is my root which git is installed there:

htdocs/
    .git
    xampp
    test
    myweb
    myweb_dependencies
    onOtherProject
    php_info.php
    .gitignore

Also here is the content of .gitignore :

# Ignore everything
*

# But not these files
!myweb
!myweb_dependencies

What I want to do is ignoring everything except these two directories: myweb and myweb_dependencies .

The problem is: apparently the content of .gitignore is wrong, because it doesn't track changes into myweb directory. How can I fix it?

It should be like this:

# Ignore everything
/*
/*/

# But not these files
!/myweb/
!/myweb_dependencies/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM