I'm confused about what's the correct way to ignore the contents of a directory in git.
Assume I have the following directory structure:
my_project
|--www
|--1.txt
|--2.txt
|--.gitignore
What's the difference between putting this:
www
And this?
www/*
The reason I'm asking this question is: In git, if a directory is empty, git won't include such empty directory in repository. So I was trying the solution that is add an extra .gitkeep file under the directory so that it won't be empty. When I was trying that solution, if in the .gitignore file, I write like below:
www
!*.gitkeep
It doesn't work(My intention is to ignore all contents under www but keep the directory). But if I try the following:
www/*
!*.gitkeep
Then it works! So I think it must has some differences between the two approaches.
bin
andbin/
is that the former will ignore files or folders, the latter only folders. I don't know the difference withbin/*
– Cabriolet