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
  • 25,790
  • 15
  • 86
  • 131
Eugene
  • 905
  • 1
  • 10
  • 22

1 Answers1

8

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

Daniël W. Crompton
  • 3,448
  • 25
  • 26
peko
  • 11,267
  • 4
  • 33
  • 48
  • @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