Reputation: 175
I have a CRUD app that will be used to track trucking appointments. I'm ready to deploy the app, but I'm worried about merging a future branch into the main branch without overwriting the existing information in the database. How can I use CLI git commands to avoid overwriting the data?
These are the general steps I've been using to merge a branch that I've made edits to into the main branch:
>git checkout main
>git merge <branch_name>
>git branch -d <branch_name>
>git push origin --delete <branch_name>
Upvotes: 1
Views: 176
Reputation: 1323135
Note: putting test.db
within my .gitignore
configuration file is not enough.
If it was tracked, you would need to "untrack" it with:
git rm --cached -- test.db
Then you can check your new .gitignore
rule is effective with:
git check-ignore -v -- test.db
Upvotes: 1
Reputation: 11
Production data should not be stored in the same directory as code for many reasons other than worrying that git will overwrite your data. For one, your software shouldn't have permissions to modify itself, even though it needs permissions to overwrite its database. You'll need to search/ask how best to package Python and set up a service on the operating system you'll be using.
git has some safety features that protect untracked files. checkout
and switch
won't clobber them. But clean
is designed to delete untracked files. Worse: reset --hard
will overwrite untracked files without warning. Do not put important data in a working directory unless it's part of the project.
Upvotes: 1