1

Is it possible to tell git to stop tracking changes to the web.config file after the initial commit? I've got a .gitignore file with *.config in it. But since I committed the web.config file on the initial check in, any time I make change to web.config file it keeps track of it. But if i add a second config file it does ignore that file..

I want to be able to ignore any changes I make to the first web.config file as well.. Is this possible?

psj01
  • 3,075
  • 6
  • 32
  • 63

1 Answers1

2

To make git stop tracking the web.config completely including the initial commit.

git does not ignore a file that has already been tracked before a rule was added to .gitignore file to ignore it.

In such a case the file must be un-tracked first with this command: git rm --cached <filename>.

So if you are trying to ignore this file after the initial commit, run this: git rm --cached web.config, and you should be good to go.

To make git stop tracking future changes in web.config, apart from the initial commit.

Refer this answer as mentioned by @phd.

Pankaj Singhal
  • 15,283
  • 9
  • 47
  • 86