2

In my .gitignore file I have

tmp/**/*

What files does it exclude? Will it exclude all tmp and files/folders under it?

My other question is, is this different from the following?

tmp/*

Edit:

Reason I ask is because I a have this

.vimbackup/**/*

but it is NOT ignoring a file like .vimbackup/.somebackup~

However, if I do

.vimbackup/*

it DOES ignore the file .vimbackup/.somebackup~ Seems kinda backwards to me

Brand
  • 1,681
  • 1
  • 24
  • 32

2 Answers2

1

Usually that notation means to include any subdirectory within tmp. And then files within those directories too (because of the additional /*)

It includes sub-directories recursively as well. So tmp/billy/bob/* will be ignored as well as tmp/banjo/* and so on...

That being said. I've never used git... so I could be wrong. But many IDEs and version control programs use that notation.

Just noticed your second question. Yes it is different from just tmp/* Which will ignore all files, but not directories and their respective files.

gnomed
  • 5,483
  • 2
  • 26
  • 28
1

If a file has already been committed then git will remember it until you explicitly get git to remove it from the index/staging area. This is even if you update the .gitignore file, which can be confusing.

look at git rm <file> for removing a file that has been previously committed that you are now ignoring via the .gitignore file (see many SO Q&As).

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71