Sunday, January 18, 2026

Workflow of WordPress project in a team with Git

1. We should not push any Wordpress core folders or files to github.

2. Only push custom theme and custom plugin into github.

3. So, in this case first create a .gitignore files that ignore all core folders and files to push into github.

Example .gitignore code:

# ===============================
# WordPress Core (optional)
# ===============================
/wp-admin/
/wp-includes/
/wp-*.php
/xmlrpc.php
/readme.html
/license.txt

# ===============================
# WordPress Content
# ===============================
/wp-content/uploads/
/wp-content/cache/
/wp-content/upgrade/
/wp-content/ai1wm-backups/
/wp-content/backup*/
/wp-content/backups/
/wp-content/wflogs/
/wp-content/debug.log
/wp-content/themes/index.php

# ===============================
# Plugins & Themes (keep only custom)
# ===============================
/wp-content/plugins/*
!/wp-content/plugins/your-custom-theme/

/wp-content/themes/*
!/wp-content/themes/your-custom-plugin/

# ===============================
# Config & Environment
# ===============================
wp-config.php
.env
.env.*
*.log
.htaccess

# ===============================
# OS / Editor files
# ===============================
.DS_Store
Thumbs.db
.vscode/
.idea/

# ===============================
# Composer / Node
# ===============================
/vendor/
/node_modules/
package-lock.json
yarn.lock

# ===============================
# Cache / Temp
# ===============================
*.cache
*.tmp

4. So, in github we'll see only three things, wp-content folder, index.php and .gitignore. Inside of wp-content, there will be themes folder and inside of that themes folder your custom theme.

5. So, after initial commit and push to github, it is time to clone it from github to your co-worker's local development environment.

6. In your co-worker's development environment, they will have wordpress installed. Then go inside your wordpress folder and in root run few git command:

- git init

- git remote add origin YOUR-REPOSITORY-LINK

- git fetch origin

- git checkout -f main

Co-workers are done and synced now!
Ready to start working...







No comments:

Post a Comment

Workflow of WordPress project in a team with Git

1. We should not push any Wordpress core folders or files to github. 2. Only push custom theme and custom plugin into github. 3. So, in this...