简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM