hi there, - 2016.antwerp.wordcamp.org · hi there, i'm mark (with a k) dad, front-end lover,...
TRANSCRIPT
HI THERE,
I'M MARK (WITH A K)Dad, Front-end lover, author, teacher, WordPress enthousiast
WORDPRESS DEPLOYMENTWITH GIT
HOW TO KILL YOUR FTP HABITS.
WHY YOU SHOULD CONSIDER SWITCHING TO GIT(AS DEPLOYMENT TOOL)
FTP (File Transfer Protocol)
Slower -> 2 connectionsHuman actionsManual Cherrypickupdates
GIT (code version control)
1 way connection -> UPAutomated actionsOnly deploy changesIt's 2016
IS GIT REALY FASTER?Based on a small (4 pages, with pictures) WordPress website
FTP (File Transfer Protocol) GIT (code version control)
That's whopping ~95% faster
GIT FOR THE WIN
TO GET STARTED WITH GIT DEPLOYMENT:Project code in GIT (duh)Server with SSH accessGIT should be enabled on remote server (default)
SERVER - HOW TO?ssh user@domain
cd /var/mkdir git/
cd git/ mkdir project_name.git
cd project_name.git git init --bare Initialised empty Git repository in /var/git/project_name.git/
cd /hooks/ nano post-receive
#!/bin/bash while read oldrev newrev ref do echo "Master ref received. Deploying master branch to production..." GIT_WORK_TREE=/var/www/project_name/apps/default git checkout -f done
chmod +x post-receive
LOCAL - HOW TO?cd projects/project_name
git remote add production ↵ ssh://user@domain/var/www/project_name/git/project_name.git
git push production +master:refs/heads/master
production, you can name it anything you want.
DEPLOYING CODEWORKFLOW
Each time that you make changes to your code, commit themas usual
git add . git add file.php
git commit -m "explaining the feature or fix"
git push
And then run the following command to deploy your changesto the remote server:
git push production master
THE MAIN FORMAT OF THE COMMAND:git push 'chosen name for remote server' 'branch name'
git push staging staging
git push alpha feature
git push production master
?QUESTIONS?
WORDPRESS DEPLOYMENT WITH GITMARK CREETEN
@MARK_WITH_A_K
APPSALOON IS HIRING!