Kazi Rahamatullah
Kazi Rahamatullah
AboutProjectsBlogContact
UsesBooks
ResumeView CV
Kazi Rahamatullah

© Copyright 2026 Kazi Rahamatullah

AboutProjectsBlogBooksUses
Twitter/XGitHubProduct HuntCodeSandbox
Back to Blog
MERNGitGitHubVercelNetlifyDevOps

MERN Course: Git & Deployment Essentials

Week 5 of the MERN syllabus — Git workflows, GitHub collaboration, branching, pull requests, and deploying static sites to GitHub Pages, Netlify, and Vercel.

Jul 6, 20263 min read

Introduction

Version control and deployment are non-negotiable MERN skills. This post completes the Git Essentials week with commands you will use daily, collaboration patterns, and deployment best practices.

Course Reference

Quick index

#TopicDescription
1Mastering Version Control with GitGit tracks every change in your codebase.
2Collaborative Coding with GitHubGitHub hosts remote repositories.
3Deploying Static Sites (GitHub Pages, Netlify, Vercel)Static sites serve pre-built HTML/CSS/JS from a CDN.

Week 5: Git, GitHub & Static Deployments

1. Mastering Version Control with Git

Git tracks every change in your codebase. Commits are snapshots; branches let you work on features without breaking main.

  • git init — start a repository
  • git add + git commit — stage and snapshot changes
  • git branch / git checkout — isolate feature work
  • git merge — combine branches (resolve conflicts carefully)

Example:

bash
# Start tracking a MERN project
git init
git add .
git commit -m "feat: initial portfolio setup"
 
# Feature branch workflow
git checkout -b feature/blog-mdx
# ... make changes ...
git add content/mern/
git commit -m "feat: add MERN course blog posts"
git checkout main
git merge feature/blog-mdx

Note

Write commit messages in imperative mood: "add", "fix", "refactor". Small, focused commits are easier to review and revert.

Tip

Commit small and often — each commit should represent one logical change.

Performance

Add a .gitignore for node_modules, .env.local, and .next — committing dependencies bloats clones and CI time.

Back to index


2. Collaborative Coding with GitHub

GitHub hosts remote repositories. SSH keys authenticate pushes. Pull requests propose changes; code review catches bugs before merge.

Example:

bash
# Generate SSH key (one-time)
ssh-keygen -t ed25519 -C "you@example.com"
 
# Clone and push
git clone git@github.com:rahmat058/kazi-rahamatullah.git
cd kazi-rahamatullah
git push -u origin main
 
# Fork workflow: push to your fork, open PR to upstream

Note

Never commit secrets. Use GitHub Secrets for CI tokens. Rotate keys if accidentally pushed.

Tip

Commit small and often — each commit should represent one logical change.

Warning

Never push .env files or API keys to a public repository.

Performance

Shallow clones (git clone --depth 1) speed up CI pipelines that only need the latest commit.

Back to index


3. Deploying Static Sites (GitHub Pages, Netlify, Vercel)

Static sites serve pre-built HTML/CSS/JS from a CDN. Git-connected platforms rebuild on every push — zero manual FTP uploads.

  • GitHub Pages — free hosting for static HTML from a branch or /docs
  • Netlify — drag-and-drop or Git deploys with form handling and redirects
  • Vercel — optimized for Next.js with edge network and preview URLs per PR

Example:

json
# vercel.json — optional redirects
{
  "redirects": [
    { "source": "/old-blog/:slug", "destination": "/blog/:slug", "permanent": true }
  ]
}
 
# Deploy Next.js (this portfolio)
pnpm build
vercel --prod

Note

Set environment variables in the hosting dashboard — never hardcode API keys in client bundles.

Tip

Commit small and often — each commit should represent one logical change.

Warning

Never push .env files or API keys to a public repository.

Performance

Vercel and Netlify serve assets from global CDNs. Enable compression and cache headers; Next.js handles most of this automatically.

Back to index


Share this article

XLinkedInFacebook
Kazi Rahamatullah

Written by

Kazi Rahamatullah

FullStack Developer

X / TwitterGitHubLinkedIn

Subscribe to my newsletter

Stay up to date and get notified when I share new contents.

No spam ever, unsubscribe anytime