Maybe this question is too broad (I hope not) but I'm currently don't know, how to solve my WordPress Git Branching Model problem.
My plan was to create a branching model like this without using a BitBucket Server or Jenkins:
So I've started making a git init
in the wp-content
folder of my PROD
(at this time only installation of WP) system.
After I was done with this, I've cloned the whole PROD
page and created a staging
subdomain. After cloning was completed, I've deleted the wp-content
folder at the staging
system and typed in a git clone <prod-path>/.git
.
This worked great and after doing some changes (for testing purposes) at the staging version, I was able to push them back to the PROD
. Until now, everything is logic and normal and worked very well.
After thinking some time, I've got the great (maybe stupid) idea, to do the same with a local DEV
clone on my PC. So I've did the same like at the staging version before, but this time, I've cloned the staging wp-content
clone (PROD
clone) to my local DEV
version.
For the first view, everything looked fine but after trying to push something to the Staging system, I've got rejected
from the target staging Git
:
remote: error: refusing to update checked out branch: refs/heads/development
remote: error: By default, updating the current branch in a non-bare repository
So I first thought, that it's very stupid what I did, because the staging is also a clone without a HEAD
like on the PROD
(I think).
So my question to you:
Do you have an idea, how I can keep this kind of Workflow without any 3rd party software, but with 2 clones that I can work on DEV
, test on Staging
and going live on PROD
?
To say it with commands:
1. git push <to the staging>
2. git push <to the prod>
3. git merge <dev to master>
Update
This is the content of my bare hooks folder (there is no post-received, what should I do?):
/wp-content/.bare/hooks$ ls -la
total 56
drwxr-xr-x 2 wp_ftp psacln 4096 Apr 11 13:09 .
drwxr-xr-x 7 wp_ftp psacln 4096 Apr 11 13:20 ..
-rwxr-xr-x 1 wp_ftp psacln 478 Apr 11 13:09 applypatch-msg.sample
-rwxr-xr-x 1 wp_ftp psacln 896 Apr 11 13:09 commit-msg.sample
-rwxr-xr-x 1 wp_ftp psacln 3327 Apr 11 13:09 fsmonitor-watchman.sample
-rwxr-xr-x 1 wp_ftp psacln 189 Apr 11 13:09 post-update.sample
-rwxr-xr-x 1 wp_ftp psacln 424 Apr 11 13:09 pre-applypatch.sample
-rwxr-xr-x 1 wp_ftp psacln 1642 Apr 11 13:09 pre-commit.sample
-rwxr-xr-x 1 wp_ftp psacln 1492 Apr 11 13:09 prepare-commit-msg.sample
-rwxr-xr-x 1 wp_ftp psacln 1348 Apr 11 13:09 pre-push.sample
-rwxr-xr-x 1 wp_ftp psacln 4898 Apr 11 13:09 pre-rebase.sample
-rwxr-xr-x 1 wp_ftp psacln 544 Apr 11 13:09 pre-receive.sample
-rwxr-xr-x 1 wp_ftp psacln 3610 Apr 11 13:09 update.sample