🚀 DevOps Roadmap 2025: Step 1 – Version Control with Git & GitHub (Hands-on Guide for Beginners)

🧭 Introduction
Welcome to Part 1 of the “DevOps Roadmap 2025” series! 🚀
If you're a fresher, student, or beginner in DevOps, the first step you must take is mastering Git and GitHub. Why?
Because version control is the foundation of collaboration, deployment, and automation in DevOps.
In this guide, you’ll learn:
✅ What Git and GitHub are
✅ How to use basic & advanced Git commands
✅ How to create a GitHub project (step-by-step)
✅ Git branching strategies like Git Flow
✅ 30+ interview questions with answers (fresher + experienced level)
Let’s get started!
🧠 What is Version Control?
Let’s say you're working on a Word document and keep saving different versions like:
Resume_Final.docx
Resume_Final_v2.docx
Resume_ACTUALLY_Final.docx
It’s confusing, right?
Version Control tools like Git solve this by keeping track of every change you make, and you don’t need to create multiple files.
💡 Think of Git as a time machine for your code.
🔧 What is Git?
Git is a free, open-source version control system developed by Linus Torvalds (creator of Linux). It allows:
Tracking of file changes
Collaboration with others
Reverting back to older versions
Offline development
💡 Git is the tool installed on your local system.
☁️ What is GitHub?
GitHub is a cloud-based platform to host your Git repositories. It enables:
Team collaboration
Open-source contribution
Code backup & version history
Portfolio building
💡 GitHub is where your Git-managed project lives online.
💻 Install Git on Your System
🔸 Windows
Download from: https://git-scm.com/
Install with default options
Open Git Bash or Command Prompt:
git --version
🔸 Linux
sudo apt update
sudo apt install git
git --version
🔸 macOS
brew install git
git --version
📦 Create a Project on GitHub (Step-by-Step)
Go to https://github.com
Log in and click the “+” icon → New repository
Fill:
Repository name:
my-first-project
✅ Make it Public
✅ Check
Initialize with README
Click Create repository
🔗 Clone GitHub Repository to Your System
git clone https://github.com/yourusername/my-first-project.git
cd my-first-project
🧪 Git Basics: Commands Every Beginner Must Know
Command | Description |
git init | Initialize a new Git repo |
git clone <repo> | Copy remote repo to local |
git status | Show status of files (modified, staged, etc.) |
git add . | Stage all changes for commit |
git commit -m "msg" | Save staged changes with message |
git push | Upload commits to GitHub |
git pull | Fetch + merge latest code from GitHub |
🚀 Advanced Git Commands (Explained)
🔁 git fetch
vs git pull
Command | What it does |
git fetch | Downloads changes (no merge) |
git pull | Downloads + merges automatically |
🍒 git cherry-pick
Apply a specific commit from another branch into your current one:
git cherry-pick <commit-hash>
✅ Use when you only want 1 commit from another branch (like a hotfix).
🔄 git reset
vs git revert
Command | Action |
git reset | Deletes commits (rewrites history) |
git revert | Undoes via new commit |
🧺 git stash
Temporarily stores your changes:
git stash # Save changes
git stash pop # Restore later
🧾 git log
Shows commit history:
git log
git log --oneline
🌿 What is Git Flow?
Git Flow is a branching strategy to organize work in teams.
Branch | Use Case |
main | Stable, production code |
develop | Active development base |
feature/* | New features |
release/* | Release prep |
hotfix/* | Urgent production fixes |
✅ Git Flow Interview Answer
Q: What is Git Flow and why is it used?
Git Flow is a branching strategy that defines how to manage feature development, releases, and hotfixes using well-named branches. It brings structure and helps in team collaboration during the software lifecycle.
💼 Git & GitHub Interview Questions (With Answers)
🟢 For Freshers
What is Git?
Git is a version control system to track code changes and support collaboration.What is GitHub?
GitHub is an online platform to host Git repositories.What is
git init
used for?
It initializes a new Git repository.What’s the use of
.gitignore
?
Lists files/folders Git should ignore (e.g.,node_modules/
,.env
).Difference between
git fetch
andgit pull
?
fetch
: only downloads changes.
pull
: downloads and merges changes.How to resolve merge conflicts?
Fix the file manually →git add .
→git commit -m "Resolved conflict"
🔵 For Experienced
What is
git cherry-pick
?
Used to apply a specific commit from one branch into another.How to rebase a branch?
git checkout feature
git rebase main
What is a detached HEAD?
A state where HEAD points to a specific commit, not a branch.How to rename a branch?
git branch -m old-name new-name
- How to delete local and remote branches?
git branch -d feature-x # local
git push origin --delete feature-x # remote
- Explain Git Flow strategy?
Organizes work using structured branches (main
,develop
,feature/
,hotfix/
, etc.) to streamline development and release processes.
🔚 Conclusion
If you’re serious about DevOps or any modern development, mastering Git and GitHub is the first non-negotiable step.
You’ve now learned:
How to create GitHub projects
Real-world Git commands
Git Flow strategy
Interview questions (with answers)
✅ Next in the DevOps Roadmap:
Step 2: Linux for DevOps – Basic to Advanced Commands You Must Know
Learn essential Linux commands, scripting, permissions, and how to manage servers as a DevOps engineer. With hands-on examples and interview Q&A.
📢 Share & Follow
If this blog helped you:
💬 Share it on LinkedIn using
#DevOpsRoadmap2025
🔖 Bookmark it for revision
🧠 Follow me on Hashnode/LinkedIn for the next blog on Linux for DevOps
Subscribe to my newsletter
Read articles from Harshal Sonar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
