4

I have directory which starts with exclamation mark, like:

!test

I want to add it in gitignore, but this doesn't seem to work:

\!test

What is the correct way to do this?

Jimbo
  • 24,958
  • 14
  • 82
  • 121
Eugene
  • 578
  • 6
  • 20

1 Answers1

8

You can escape it with a backslash => \!test

Daniël W. Crompton
  • 3,338
  • 23
  • 26
peko
  • 11,199
  • 4
  • 32
  • 47
  • @Eugene I think it is ok, have tested it on my machine (git version 1.8.3.4). Make sure that you can't ignore a file already tracked, check [this](http://stackoverflow.com/questions/7231608/git-ignore-files-which-are-on-repository). – dyng Aug 20 '13 at 13:46
  • @Eugene no didn't try it, but i know you can escape special chars with a backslash – peko Aug 20 '13 at 13:56
  • @Eugene I tried. It works. Please, mark the answer as correct. – polkovnikov.ph Dec 27 '17 at 20:51