Mohammed
Mohammed

Reputation: 757

Ignore a file in current directory but exclude a directory with the same name

I have the following directory structure:

-- dir

---- dir/server (binary file)

---- dir/docker/server/Dockerfile

In my .gitignore I have the following:

 server

git is ignoring the sub dir docker/server/Dockerfile as well.

How Do I fix it?

Upvotes: 2

Views: 27

Answers (1)

jhill515
jhill515

Reputation: 943

Try dir/server. The gitignore file looks for regex-like patterns, so it shouldn't ignore the docker/server/* files as they don't fit the previous pattern.

Upvotes: 4

Related Questions