Reputation: 33625
In my .gitignore
file I want to ignore a file just called .env
but not files that have something.env
:
I have tried this:
.env
!*.env
But it does not work
Upvotes: 1
Views: 2249
Reputation: 476659
Why can't you simply ignore .env
. Thus your .gitignore
reads:
.env
(only one line)
It will not ignore anything with the .env
extension.
Example (console):
$ echo 'foo' > .env
$ echo 'foobar' > foo.env
$ git add .; git commit -am "foobar"
[master 49d6a00] foobar
2 files changed, 2 insertions(+), 2 deletions(-)
create mode 100644 foo.env
Upvotes: 2