M
M
Michael2019-09-24 00:27:57
git
Michael, 2019-09-24 00:27:57

Work with a WordPress site through git?

Hello! Tell me how to properly work with a WordPress site through git. I have a WordPress site on the server, it works. I want to create a development clone on a local server. And push changes. In principle, I am familiar with Git, but I don’t know how to apply it to WordPress. How to do all this correctly? Is this generally a common practice?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
OnYourLips, 2019-09-24
@OnYourLips

This is exactly how they work when the project is not a one-day project.
With this approach, it should be taken into account that many types of activities cannot be carried out in the admin panel in production (installing plugins, editing templates). They are delivered already in the process of deployment.

S
Sunflowerz, 2019-09-24
@Sunflowerz

Through git is too hard. You also have a database.
And it is actually tied to wordpress.
What if you need a database of one project on another version of wordpress?
I highly recommend using docker for this.
Here is docker-compose.yml after installing docker and docker compose windows mac debian
Now you need two empty folders in your project folder. wordpress and bd.
Run: docker-compose upin the project folder with the saved docker-compose.yml file described below.
Here is an excellent course on YouTube of our compatriot

version: '3.1'

services:

  wordpress:
    build:
      context: ./wordpress
    image: wordpress
    restart: always
    ports:
      - 8080:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: exampleuser
      WORDPRESS_DB_PASSWORD: examplepass
      WORDPRESS_DB_NAME: exampledb
    volumes:
      - ./wordpress:/var/www/html

  db:
    build:
      context: ./db
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_DATABASE: exampledb
      MYSQL_USER: exampleuser
      MYSQL_PASSWORD: examplepass
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      - ./db:/var/lib/mysql

volumes:
  wordpress:
  db:

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question