Makefile Commands
The project includes a Makefile that provides convenient shortcuts for common development and deployment tasks.
Quick Reference
Section titled “Quick Reference”| Command | Description |
|---|---|
make or make help | Show all available commands |
make deploy | Deploy main branch to production |
make pull | Pull latest from GitHub |
make sync | Sync production branch to local |
make diff | Show coworker’s changes |
make log | View recent production commits |
make ssh | SSH into production server |
make status | Check production server status |
make pr | Open GitHub PR page |
make compare | Open GitHub compare view |
make db-export | Export production database schema |
make db-import | Import schema to local MySQL |
make db-sync | Full database sync (export + import) |
make db-start | Start local MySQL service |
make db-stop | Stop local MySQL service |
make server | Start PHP development server |
Deployment Commands
Section titled “Deployment Commands”make deploy
Section titled “make deploy”Deploy the main branch to production server.
make deployWhat it does:
- SSH into production server
- Stash any uncommitted changes
- Checkout
mainbranch - Pull latest code from GitHub
- Pop stashed changes (if any)
Example output:
Deploying main branch to production...Switched to branch 'main'Already up to date.Deploy complete!When to use:
- After pushing changes to
mainbranch - When you want to sync production with GitHub
make pull
Section titled “make pull”Pull latest changes from GitHub main branch to local.
make pullEquivalent to:
git pull origin mainWhen to use:
- Start of day to get latest changes
- Before starting new work
- After coworker merges changes
Git Sync Commands
Section titled “Git Sync Commands”make sync
Section titled “make sync”Sync the production branch (coworker’s FTP changes) to local.
make syncWhat it does:
git fetch origin productiongit checkout productiongit pull origin productiongit checkout mainWhen to use:
- To review coworker’s FTP changes
- Before merging production changes into main
- To see what was auto-committed
make diff
Section titled “make diff”Show differences between main and production branches.
make diffExample output:
Changes in production (FTP) not yet in main:============================================= app-dashboard.php | 12 ++++++++++-- app-crm-full.php | 5 +++-- config.php | 1 + 3 files changed, 14 insertions(+), 4 deletions(-)When to use:
- Daily check for coworker’s changes
- Before creating a merge PR
- To see what’s different between branches
make log
Section titled “make log”View recent auto-commits on the production branch.
make logExample output:
Recent auto-commits from production:=====================================a1b2c3d Auto-commit: 2026-01-21 14:30:00e4f5g6h Auto-commit: 2026-01-21 14:15:00i7j8k9l Auto-commit: 2026-01-21 14:00:00When to use:
- See what coworker changed recently
- Check auto-commit frequency
- Review commit history
Server Commands
Section titled “Server Commands”make ssh
Section titled “make ssh”SSH into the production server.
make sshEquivalent to:
ssh mymarketingproLands you in:
ubuntu@ip-172-31-24-17:~$When to use:
- Check server logs
- Run manual commands on server
- Troubleshoot issues
make status
Section titled “make status”Check the production server’s git status.
make statusExample output:
Production server git status:==============================On branch mainYour branch is up to date with 'origin/main'.
nothing to commit, working tree clean
Current branch:mainWhen to use:
- Verify current branch on server
- Check for uncommitted changes
- Ensure deployment succeeded
GitHub Shortcuts
Section titled “GitHub Shortcuts”make pr
Section titled “make pr”Open GitHub to create a pull request from production to main.
make prOpens:
https://github.com/my-marketing-pro/mmp-webapp/compare/main...production?expand=1When to use:
- After reviewing coworker’s changes
- To merge FTP changes into main branch
make compare
Section titled “make compare”Open GitHub compare view to see differences.
make compareOpens:
https://github.com/my-marketing-pro/mmp-webapp/compare/main...productionWhen to use:
- Visual review of coworker’s changes
- Before creating PR
- Sharing changes with team
Database Commands
Section titled “Database Commands”make db-export
Section titled “make db-export”Export production database schema to local file.
make db-exportWhat it does:
- SSH into production server
- Run
mysqldump --no-data(structure only, no data) - Save to
/tmp/mmp_app_schema.sql
Example output:
Exporting production database schema...Schema exported to /tmp/mmp_app_schema.sql 11124 /tmp/mmp_app_schema.sqlFile contains:
- Table definitions
- Indexes
- Foreign keys
- Views
- ~11,124 lines
When to use:
- First time setup
- After production schema changes
- To update local structure
make db-import
Section titled “make db-import”Import schema from /tmp/mmp_app_schema.sql to local MySQL.
make db-importWhat it does:
mysql -u root mmp_app < /tmp/mmp_app_schema.sqlWhen to use:
- After running
make db-export - To sync local database structure
- After production adds new tables
Prerequisites:
- Local MySQL running
mmp_appdatabase exists- Schema file exists at
/tmp/mmp_app_schema.sql
make db-sync
Section titled “make db-sync”Full database sync: export from production and import to local.
make db-syncWhat it does:
- Run
make db-export - Run
make db-import
This is the most common database command for keeping local in sync.
Example output:
Syncing database schema from production to local...Exporting production database schema...Schema exported to /tmp/mmp_app_schema.sql 11124 /tmp/mmp_app_schema.sqlImporting schema to local mmp_app database...Import complete!Database sync complete!When to use:
- Daily or weekly to stay in sync
- After production schema changes
- When local database is out of date
make db-start
Section titled “make db-start”Start local MySQL service.
make db-startWhat it does:
brew services start mysqlExample output:
Starting MySQL...==> Successfully started `mysql` (label: homebrew.mxcl.mysql)
Name Status User Filemysql started username ~/Library/LaunchAgents/homebrew.mxcl.mysql.plistWhen to use:
- Start of development session
- After system restart
- When MySQL is not running
make db-stop
Section titled “make db-stop”Stop local MySQL service.
make db-stopWhat it does:
brew services stop mysqlWhen to use:
- End of development session
- To free up system resources
- Before system maintenance
Development Server
Section titled “Development Server”make server
Section titled “make server”Start PHP development server on localhost:8000.
make serverWhat it does:
php -S localhost:8000Example output:
Starting PHP development server on http://localhost:8000Press Ctrl+C to stop[Wed Jan 21 14:30:00 2026] PHP 7.4.33 Development Server (http://localhost:8000) startedAccess your app:
- Main:
http://localhost:8000 - Dashboard:
http://localhost:8000/app-dashboard.php - Auth:
http://localhost:8000/app-auth.php
To stop: Press Ctrl+C
When to use:
- Local development
- Testing changes before deployment
- Working on features locally
Command Combinations
Section titled “Command Combinations”Daily Development Start
Section titled “Daily Development Start”# Full setup for developmentmake pull # Get latest codemake db-start # Start MySQLmake db-sync # Sync databasemake server # Start PHP serverReview and Deploy Workflow
Section titled “Review and Deploy Workflow”# Review coworker's changesmake diff # See what changedmake log # View commitsmake compare # Open GitHub
# If changes look good, merge then deploymake deploy # Deploy to productionmake status # Verify deploymentDatabase Refresh
Section titled “Database Refresh”# Refresh local database structuremake db-sync # Export from production, import to localDeployment Verification
Section titled “Deployment Verification”# After deploying, verifymake status # Check server statusmake ssh # SSH in to check logsMakefile Source
Section titled “Makefile Source”The Makefile is located at:
/Users/jzamudio/Desktop/mmp/mmp-webapp/MakefileTo see all commands:
make help# or just:makeCustomizing Commands
Section titled “Customizing Commands”You can add your own commands to the Makefile:
# Example: Add a custom command.PHONY: test
test: @echo "Running tests..." php vendor/bin/phpunit tests/Then use it:
make testTroubleshooting
Section titled “Troubleshooting”Command Not Found
Section titled “Command Not Found”make: command not foundSolution: Install make via Xcode Command Line Tools:
xcode-select --installSSH Connection Fails
Section titled “SSH Connection Fails”make ssh# Permission denied (publickey)Solution: Ensure SSH key is loaded:
ssh-add ~/.ssh/mymarketingproDatabase Commands Fail
Section titled “Database Commands Fail”make db-sync# ERROR 2002: Can't connect to local MySQL serverSolution: Start MySQL first:
make db-start# Wait a few secondsmake db-syncServer Port In Use
Section titled “Server Port In Use”make server# Address already in useSolution: Use a different port:
php -S localhost:8001Next Steps
Section titled “Next Steps”- Git Workflow - Learn the Git workflow
- Development Workflow - Development best practices
- Deployment - Deployment procedures