0

I have a folder called .tmp.

In my .gitignore file, I am trying to exclude everything in it.

I have tried .tmp, .tmp/*/, etc.

I believe this is because it is looking for a file with a .tmp extension. Is there a way to define that this is a directory and not an extension?

Holden Lewis
  • 387
  • 3
  • 18
developthewebz
  • 1,827
  • 3
  • 17
  • 43

1 Answers1

1
.tmp

in .gitignore should work fine.

.tmp won't get commited to git as long as you don't use "git add --force"

If you want to have .tmp folder, but no file commited to it, just write this in .tmp/.gitignore :

*
!.gitignore
Eric Duminil
  • 52,989
  • 9
  • 71
  • 124
  • ".tmp won't get commited at all to git." --- it won't be shown in the status or staged. But it does not affect comitting at all. – zerkms Nov 09 '16 at 01:00
  • Interesting comment. Can `.tmp` be commited without being staged? – Eric Duminil Nov 09 '16 at 09:45
  • You can stage it and commit. Being ignored does not mean you cannot stage and commit it. – zerkms Nov 09 '16 at 19:07
  • Wouldn't you need to type `git add -f .tmp`? – Eric Duminil Nov 09 '16 at 19:42
  • Yes, you would. My initial point is ".tmp won't get commited at all to git." misleading, since `.gitignore` does not affect on what is to be committed (but staging and other status-alike commands) – zerkms Nov 09 '16 at 19:47