DEV Community

Cover image for Git A to Z: Local Setup to Advanced Workflow for Real-World Devs
Masaud Ahmod
Masaud Ahmod

Posted on

1

Git A to Z: Local Setup to Advanced Workflow for Real-World Devs

Is it even possible to be a real-world developer without Git? Absolutely not.

In this post, I’ll guide you from zero to pro with Git — including installation, terminal usage, VS Code integration, and both basic & advanced commands.


🔧 ১. Git Installation & Local Setup

✅ Step 1: Install Git

✅ Step 2: Git Global Config

git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Enter fullscreen mode Exit fullscreen mode

✅ Step 3: Add SSH Key (for GitHub/GitLab)

ssh-keygen -t ed25519 -C "youremail@example.com"
Enter fullscreen mode Exit fullscreen mode

Then copy your public SSH key and add it to your GitHub/GitLab SSH settings.


📁 ২. Initial Project Setup & First Commit

🔹 Git Init

git init
Enter fullscreen mode Exit fullscreen mode

🔹 File Stage & Commit

git add .
git commit -m "Initial commit"
Enter fullscreen mode Exit fullscreen mode

🔹 Remote Add & Push

git remote add origin https://github.com/yourname/your-repo.git
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

🧪 ৩. Daily Workflow with Git (Pull, Push, Branching)

🔹 Clone

git clone https://github.com/yourname/project.git
Enter fullscreen mode Exit fullscreen mode

🔹 Pull

git pull origin main
Enter fullscreen mode Exit fullscreen mode

🔹 Branch Create & Switch

git checkout -b feature-x
Enter fullscreen mode Exit fullscreen mode

🔹 Merge

git checkout main
git merge feature-x
Enter fullscreen mode Exit fullscreen mode

🧠 ৪. Advanced Git Commands

🔹 Stash & Pop

git stash
git stash pop
Enter fullscreen mode Exit fullscreen mode

🔹 Rebase

git checkout feature
git rebase main
Enter fullscreen mode Exit fullscreen mode

🔹 Cherry-pick

git cherry-pick <commit-id>
Enter fullscreen mode Exit fullscreen mode

🔹 Reset to Previous Commit

git reset --hard HEAD~1
Enter fullscreen mode Exit fullscreen mode

💣 ৫. Common Mistakes & Fixes

  • Merge Conflict? Don’t panic. Fix the conflict markers, commit, and continue.

  • Detached HEAD? Switch back to a branch:

git switch main
Enter fullscreen mode Exit fullscreen mode
  • Pulled wrong changes? Use git reflog to recover lost commits.

🚀 Bonus Tools

  1. GitHub CLI

  2. GitLens Extension (VS Code)

  3. Git Graph (VS Code Extension)

  4. GitHub Copilot

🧾 Cheat Sheet

📎 Download PDF: Git Cheat Sheet PDF


🙌 Connect With Me

🔗 GitHub: @masaudahmod

💬 Leave a comment if you want a Git crash course in video format

🌟 Follow me for more content on Git, React, Firebase, and MERN stack development

Heroku

Built for developers, by developers.

Whether you're building a simple prototype or a business-critical product, Heroku's fully-managed platform gives you the simplest path to delivering apps quickly — using the tools and languages you already love!

Learn More

Top comments (0)

ACI image

ACI.dev: Fully Open-source AI Agent Tool-Use Infra (Composio Alternative)

100% open-source tool-use platform (backend, dev portal, integration library, SDK/MCP) that connects your AI agents to 600+ tools with multi-tenant auth, granular permissions, and access through direct function calling or a unified MCP server.

Check out our GitHub!