gitignore-subdirectory-exception

Create a project-specific .gitignore with negation rules to track a subdirectory.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/shiftrepo/aws --skill gitignore-subdirectory-exception
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gitignore-subdirectory-exception
Source: https://github.com/shiftrepo/aws/tree/main/HermesAgent/skills/skills/github/gitignore-subdirectory-exception
Command: npx skills add https://github.com/shiftrepo/aws --skill gitignore-subdirectory-exception

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Root or global .gitignore files can exclude entire folders (for example data/), preventing tracking of important subdirectories within a project. This Skill shows how to retain selective tracking for a subdirectory by applying project-specific negation rules.

Core Features & Use Cases

  • Create a project-specific .gitignore to override root exclusions using negation patterns like !data/ and !data/**
  • Apply the technique within multi-project repositories to selectively track subdirectories while keeping the global ignore intact
  • Provide a simple, repeatable workflow for enabling version control on targeted folders without affecting other ignored paths

Quick Start

Create a project-specific .gitignore that negates the root ignore rules to track a subdirectory, then commit and push.

Frequently Asked Questions about gitignore-subdirectory-exception

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I unignore a subdirectory in git when the parent folder is ignored?

Unignore a subdirectory in git by creating a project-specific .gitignore with negation patterns like !data/ and !data/** to override the root exclusions. This selectively tracks the subfolder while keeping the parent folder ignored.

What is a gitignore negation rule and when should I use it?

A gitignore negation rule uses an exclamation mark to re-include previously ignored paths. Use it when a root or global .gitignore excludes an entire folder but you need to track specific subdirectories within it, common in monorepos.

Can I track a data subfolder in a monorepo without removing the global gitignore exclusion?

Yes, you can track a data subfolder in a monorepo without altering the global gitignore. Add a project-specific .gitignore file using negation rules to re-include the targeted subdirectory while the global exclusion remains intact.

Why does my gitignore negation pattern not work for nested folders?

Gitignore negation patterns fail for nested folders if parent directories remain excluded. You must first negate the parent directory path, then negate the specific subdirectory and its contents using patterns like !data/ and !data/**.

What is the best way to override root ignore rules for selective version control tracking?

The best way to override root ignore rules is to create a local project-specific .gitignore file. Apply negation patterns to re-include the specific subdirectory, then commit the changes to enforce selective version control tracking.