Adding/Changing gitignore entries during development

We are knee deep into a .net core 1.0 RTM website project.  While trying to get automated builds to work (more on my "forced project.json for 4.6 DLL and .net core" frustration later), I discovered that GIT was including project.lock.json files in the commit. 

I realized that we never upgraded our .gitignore file to incldue the new DNX file omissions.   This is easier than I originally expected:

Step #1 Identify your desired changes

I found, helpful in that it produces template .gitignore files based on your desired development environment. 

To fast-forward, here is the latest for Visual Studio 2015 Update 3, which includes DNX/.net core 1.0 omissions.

Step #2 Make the changes and apply to the repo branch 

Here you have 2 options, either: 

  1. Physically remove the .gitignore file from the repo, commit your change (removal), then add it back, make your desired changes from Step 1 and commit again.  
  2. Leave the .gitignore file , but remove it from the index using:
    git rm --cached project.lock.json

I completed option A and it worked perfectly.


  • There is another way to change gitignore entries - git update-index --assume-unchanged <file>
    git update-index --no-assume-unchanged <file>
    You can read about it on Stackoverflow -
    I tried you to make it the way you suggest in my project for these guys - - and it works just fine too. Thanks

  • It's great to see you blogging again, Scott!

  • Sorry, the link is no good -

Comments have been disabled for this content.