Skip to content

en/2024/01/10/gitignore-specific-files-in-ignored-directory/ #4

Open

Description

@utterances-bot

Adding Specific Files from Ignored Directories in .gitignore | RealCoding Tech Blog

Sharing practical development insights and technical know-how from real-world experience

https://realcoding.blog/en/2024/01/10/gitignore-specific-files-in-ignored-directory/

Activity

  1. jules43 commented on Apr 16, 2026

    @jules43

    The example you give under 'Extension-based Selective Inclusion:'

    # Ignore all files but include only .md files
    docs/**
    !docs/**/*.md
    

    Describes exactly what I want to do, but it doesn't seem to work when I try it.

    The .gitignore documentation says:

    It is not possible to re-include a file if a parent directory of that file is excluded.
    

    Is there some way around the problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions