Following the initial deployment of our server-side Git hook architecture, we shifted focus toward operational velocity, production path transparency, and codebase consolidation. Here is how we implemented custom terminal aliases, redirected the post-receive hook to target the true public web root, synced cross-environment database schemas, and remediated legacy DOM bugs.
During high-frequency deployment sprints, repeatedly typing multi-word commands slows momentum. To streamline local staging, committing, and pushing, we configured custom shell aliases inside our workstation's Git Bash profile (~/.bashrc).
| Alias | Underlying Command | Operational Purpose |
|---|---|---|
gs |
git status |
Instant audit of modified, untracked, or staged assets. |
ga |
git add . |
Stages all local changes across the repository in a single stroke. |
gc "msg" |
git commit -m "msg" |
Creates concise, immutable version control snapshots. |
gp |
git push sandbox-remote main |
Triggers encrypted SSH transport and executes remote deployment hooks. |
# Sub-second deployment sequence via aliases ga && gc "feat: refactor navigation dependencies and root paths" && gp
Initially, our post-receive hook deployed files into an isolated subfolder (/public_html/sandbox-repo/). While effective for initial testing, this left live production URLs looking awkward (squirrelworks.dev/sandbox-repo/page.php). To establish a clean user experience, we updated the hook script in ~/repo/sandbox-repo.git/hooks/post-receive to check out files directly into /public_html/.
#!/bin/bash # Reconfigured post-receive hook pointing directly to public_html git --work-tree=/home/squirrel/public_html --git-dir=/home/squirrel/repo/sandbox-repo.git checkout -f main
This path correction achieved two structural advantages:
squirrelworks.dev/page.php) without exposing subdirectory implementation details.Rapidly migrating legacy files into a live environment exposed several hidden dependency edge-cases and subtle syntax bugs that manual FTP transfers had previously masked.
$conn): Fixed quiet PHP execution halts on landing queries by centralizing createConnChinook() within mainfunctions.php, ensuring valid database resource handles across all including pages.</a>) around image elements inside preceding carousel slides, causing the browser parser to extend links down into the footer.While Git manages application source code, database structures require separate synchronization. Diverged schemas between local MySQL (XAMPP) and production MySQL (KnownHost) triggered unexpected runtime errors during testing.
A prime example occurred when loading squirrel-landing.php locally: the production table had been upgraded with an articleHardDate column for precise sorting, while the local table lacked it, throwing an unhandled SQL exception (Unknown column 'articleHardDate' in 'order clause').
-- Aligning local MySQL schema with production release ALTER TABLE blogarticle ADD COLUMN articleHardDate DATE NULL;
Aligning table structures and standardizing environment detection inside mainfunctions.php established seamless database compatibility across both local development and live production.
Local development and live production have opposing web-server requirements. Local XAMPP needs open directory browsing (Options +Indexes) for rapid file navigation, whereas live production requires strict access controls (Options -Indexes) and default landing page redirects.
To prevent local server rules from overwriting production security during Git pushes, we decoupled the server configuration file from version control:
# Untrack .htaccess from version control manifest git rm --cached .htaccess echo ".htaccess" >> .gitignore git add .gitignore && git commit -m "chore: untrack htaccess for environment isolation"
Untracking .htaccess ensures that production maintains its locked-down cPanel security rules, while local workstations retain sortable file browsing without risk of cross-environment overwrite.
Enforcing root-relative URL pathing (href="/git-setup3.php") is standard practice on production to ensure links resolve cleanly from the domain root regardless of subdirectory depth. However, on local XAMPP setups, running out of a subfolder (localhost/sandbox-repo/) breaks root-relative links because Apache evaluates / as C:\xampp\htdocs\ instead of the repository root.
Rather than introducing fragile code edits or stripping leading slashes prior to Git pushes, we updated Apache's local VirtualHost configuration (httpd-vhosts.conf) to map http://localhost/ directly to the repository directory:
# Mapping local Apache root directly to workspace repository <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/sandbox-repo" ServerName localhost <Directory "C:/xampp/htdocs/sandbox-repo"> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
This environment alignment delivers two core developer benefits:
http://localhost/ and https://squirrelworks.dev/ without environment-specific hacks.Refactoring our Git pipeline transformed a basic file transfer mechanism into a robust, enterprise-grade deployment engine. By combining post-receive hook automation with proper repository hygiene and cross-environment database alignment, site updates are now published with absolute precision and sub-second latency.