ReynierPM ReynierPM - 6 months ago 44
Git Question

How to properly exclude all the files or just one in a given directory?

I have the following directory structure:

$ tree config/
├── config.ini
├── help.ini
└── services.yaml

This is part of a Git project but in the
file I am seeing the following:


As a result the file
is on the repository when it shouldn't be.

What's the right way to exclude all the files under
and how to delete them from the upstream?


First, delete (or move out of the repository) config.ini (+ any others you want to exclude) and make a commit.

Next, change your .gitignore to simply look like this:


(assuming .gitignore and config/ are at the same level)

Commit the change for your .gitignore file.

All changes to anything in config/ from here on out should not be tracked.