Home > Net >  Avoiding .gitignore on one folder
Avoiding .gitignore on one folder

Time:06-02

I have a .gitignore file on my repository to prevent uploading some files.

But I want to have a single folder inside this repository where all kind of files are allowed.

How can I scape the gitignore on that folder?

CodePudding user response:

You can negate patterns in .gitignore, causing otherwise excluded files to be included.

!folderX/**/*

A line like this in .gitignore will "unexclude" all files in folderX and its subfolders.

Note: The .gitignore file is parsed from top to bottom. Add this line at the end.
Any rule that comes after this line can override its effect.

  • Related