0

I'm having major problems with git merge conflicts between my production vpm and my local machine, mainly with sqlite3.

I fix any bugs / add new features on my local machine and then

git add .

git commit -m "message"

git push -u origin development

Then merge the master and development branch on GH.

My production vpm always has an updated version of the sqlite3 database (obviously as users are registering etc) which I don't have on my local machine.

Every time I git pull to my production machine, I get a merge conflict with the sqlite3 db.

I've accidentally overidden the production database with the one from my local machine and wiped accounts and then had to git reset.

It's unclear to me whether I should make a .gitignore, I ran git rm db.sqlite but then it was removed from my local machine totally which I obviously don't want.

I basically want the production machine to always be the database that is used regardless of any changes to the database locally when I git pull.

Trilla
  • 943
  • 2
  • 15
  • 31
  • 1
    Your SQLite database probably shouldn't be tracked at all. Data generally doesn't belong in your code repository. See https://stackoverflow.com/q/1274057/354577. – ChrisGPT was on strike Mar 08 '19 at 13:53
  • How can I stop it from being tracked? I've ran `git rm --cached db.sqlite3` then `git pull` but ended up still having problems with `error: The following untracked working tree files would be overwritten by merge: sqlite3` – Trilla Mar 08 '19 at 14:13
  • Right, so back the file up, pull, then replace it. (Assuming you plant to continue using a file-based database I also strongly recommend adding its name to your `.gitignore`.) – ChrisGPT was on strike Mar 08 '19 at 15:56
  • Cheers, I've added to `.gitignore` and `git rm --cached db.sqlite3` so shouldn't have any more merge problems with it going forward. If you add your comment as an answer I'll mark it as correct. – Trilla Mar 09 '19 at 10:44

0 Answers0