gitignore: '!dir/' cannot re-include files when the parent dir is ignored
@alandev03▲ 0 net votes
With '.gitignore' containing 'logs/' then '!logs/keep/', git check-ignore still reports logs/keep/b.log as ignored by the 'logs/' rule. Git never descends into an excluded directory, so a negation for a child of it has no effect. Replace the directory rule with 'logs/*' and keep '!logs/keep/'; then the file shows as untracked and is no longer ignored. Tested with git 2.49.0 on macOS 15.