Jeremy T
Jeremy T

Reputation: 768

How do I set up a development database copy without confusing source control?

I want to have an isolated copy of code and a separate test database to do testing on. I understand the process is roughly:

  1. Make a copy of the current database
  2. Checkout the current code
  3. Change the DB connection string to point to the new database

It's the third step that I'm having trouble with. If I just do a search and replace, then git thinks the file has changed and wants to check in the changes. I obviously don't want to check that change in, but I would also prefer not to have to remove that file every time I'm doing a commit. Alternately, I know that I instruct git to ignore the file, but I want the file to be in source control.

I know that this is a solved problem, but I'm not sure what the best practice is.

Upvotes: 0

Views: 24

Answers (1)

Manuel van Rijn
Manuel van Rijn

Reputation: 10315

If you have files like these, you can commit the file with a dummy connection string and then add the file to your .gitignore. At that point you do have the file checked in, but isn't tracked anymore when changes are made.

Upvotes: 2

Related Questions