简体   繁体   中英

Exclude sub-directories A from .gitignore from parent project, knowing that A is ignored in a sub-directory

Please consider the following project:

parent
|
|-- .gitignore
|
|-- .git
|
`--legacy
      |
      |-- .gitignore
      |
      |-- .git
      |
       `-- plugins
              |-- forum
              |     |
              |     `-- .git
              | 
              |-- chat
              |     |
              |     `-- .git
              |
               `--editor
                    |
                    `-- .git

Currently, parent project ignores legacy project ( /legacy/ in .gitignore ), and legacy ignores the plugins directory ( /plugins/ in .gitignore ).

From now on, I need git of the parent to handle chat and editor plugins. However the legacy project shouldn't be modified. I've tried adding the following entries in .gitignore of parent :

/legacy/*
!/legacy/plugins/

/legacy/plugins/*
!/legacy/plugins/chat/

I can't see chat from parent directory, so it doesn't work.

What're my options ?

Try

/legacy/*
!/legacy/plugins/chat/

It looks the same thing, but its not. Explanation here

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