0

I have two files in a config directory: local.config and local.config.example I only want local.config.example to be in git and ignore local.config.

I tried the following to .gitignore, but this doesn't seem to work. What am I doing wrong?

local.config
!local.config.example
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189

2 Answers2

0

Two Approaches,

  1. Simply add local.config in .gitignore
git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    .gitignore
    local.config.example

    cat .gitignore 
    local.config
  1. As mentioned in git ignore exception
Rishabh Dugar
  • 606
  • 5
  • 16
0

Add the path(s) to your file(s) which you would like to ignore to your .gitignore file (and commit them).

Mahan
  • 99
  • 1
  • 8