ReynierPM ReynierPM - 1 year ago 80
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download