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.
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
| # | Topic | Description |
|---|---|---|
| 1 | Mastering Version Control with Git | Git tracks every change in your codebase. |
| 2 | Collaborative Coding with GitHub | GitHub hosts remote repositories. |
| 3 | Deploying 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 repositorygit add+git commit— stage and snapshot changesgit branch/git checkout— isolate feature workgit merge— combine branches (resolve conflicts carefully)
Example:
# 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-mdx2. Collaborative Coding with GitHub
GitHub hosts remote repositories. SSH keys authenticate pushes. Pull requests propose changes; code review catches bugs before merge.
Example:
# 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 upstream3. 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:
# vercel.json — optional redirects
{
"redirects": [
{ "source": "/old-blog/:slug", "destination": "/blog/:slug", "permanent": true }
]
}
# Deploy Next.js (this portfolio)
pnpm build
vercel --prodSubscribe to my newsletter
Stay up to date and get notified when I share new contents.
No spam ever, unsubscribe anytime