Can anyone give advice on the best practice usage of github to deploy code onto Python Anywhere.
I do most of my development on my local desktop machine, using git branches locally to track various features, and then push these to our github repo. I then use pull requests to put together a single commit for deployment. I use git hub tags to mark this commit with a semantic version number.
In line with good practice, I have some files which are NOT part of the git commit - for examples my settings.py will import a set of credential modules which define key secrets such as database passwords, API secret keys etc. These change rarely.
In the vast majority of cases I only make changes via the local machine and git/github, but there have been a few cases where I have made emergency fixes on the server.
To deploy a form updated release from github, my normal workflow is :
git reset --hard # Remove and ignore local changes.
git pull origin master # get the latest code.
but recently I get nasty merge conflicts lines within files that are fine on git hub, and which i have not changed on the server.
I know the git pull command tries to do merge, but I by no means a git expert.
What is the actual best practice for getting the latest master from the github repo, onto the server since git pull is giving these errors.
What I have ended up doing is taking backups of the media and credentials folders, deleting the code on the server and then using git clone (which downloads the entire repo).
On the server I then rebuild the local virtual enviroment, restore the media and credentials folder, checkout the latest branch and the do :
python manage.py collectstatic
python manage.py migrate
etc, and then restart. with web app.
Obviously though doing a clone downloads the entire repo, including old code files and folder no longer being used, where as i would prefer to only download the latest code base : which doesn't include files now unused.