1

I want /vendor/* to be ignored except /vendor/magento/module-page-cache/.

Based on this question: .gitignore exclude folder but include specific subfolder

I came up with following gitignore

/vendor/*
!/vendor/magento/
/vendor/magento/*
!/vendor/magento/module-page-cache/

When I do git status it is only tracking /vendor/magento/ but nothing inside it.

Where did I go wrong?

Guerrilla
  • 13,375
  • 31
  • 109
  • 210

1 Answers1

0

git status command allow 3 modes, the default one does not show files within non tracked directories.

From git-status doc:

-u[<mode>]

--untracked-files[=<mode>]

Show untracked files.

The mode parameter is used to specify the handling of untracked files. It is optional: it defaults to all, and if specified, it must be stuck to the option (e.g. -uno, but not -u no).

The possible options are:

no - Show no untracked files.

normal - Shows untracked files and directories.

all - Also shows individual files in untracked directories.


By default git status is in normal mode.

You can use git status --untracked-files=all or git status -uall.

torek
  • 448,244
  • 59
  • 642
  • 775
Arount
  • 9,853
  • 1
  • 30
  • 43