Monday 19 August 2013

Git and mark as assume-unchanged

I'm working on a small side-project that is on a public GIT repository and there are a few settings that should not be seen or used by other people.

Some settings that I do not want to show are:-

  • Connection strings
  • Meetup API keys

One great way to get around this is two first create the app.config and blank out the values you don't want. Then commit and push to your remote repository. After which key in the following command:-

git update-index --assume-unchanged [fileName]

Git will then stop monitoring changes to that file allowing you to put the real config info into it without fear of checking it in. If you later make changes that you DO want to check in you can run:

git update-index --no-assume-unchanged [fileName]

Lovely!

No comments:

Post a Comment