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

Harshal SonarHarshal Sonar
5 min read

🧭 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

  1. Download from: https://git-scm.com/

  2. Install with default options

  3. 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)

  1. Go to https://github.com

  2. Log in and click the “+” icon → New repository

  3. Fill:

    • Repository name: my-first-project

    • ✅ Make it Public

    • ✅ Check Initialize with README

  4. 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

CommandDescription
git initInitialize a new Git repo
git clone <repo>Copy remote repo to local
git statusShow status of files (modified, staged, etc.)
git add .Stage all changes for commit
git commit -m "msg"Save staged changes with message
git pushUpload commits to GitHub
git pullFetch + merge latest code from GitHub

🚀 Advanced Git Commands (Explained)

🔁 git fetch vs git pull

CommandWhat it does
git fetchDownloads changes (no merge)
git pullDownloads + 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

CommandAction
git resetDeletes commits (rewrites history)
git revertUndoes 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.

BranchUse Case
mainStable, production code
developActive 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

  1. What is Git?
    Git is a version control system to track code changes and support collaboration.

  2. What is GitHub?
    GitHub is an online platform to host Git repositories.

  3. What is git init used for?
    It initializes a new Git repository.

  4. What’s the use of .gitignore?
    Lists files/folders Git should ignore (e.g., node_modules/, .env).

  5. Difference between git fetch and git pull?
    fetch: only downloads changes.
    pull: downloads and merges changes.

  6. How to resolve merge conflicts?
    Fix the file manually → git add .git commit -m "Resolved conflict"


🔵 For Experienced

  1. What is git cherry-pick?
    Used to apply a specific commit from one branch into another.

  2. How to rebase a branch?

git checkout feature
git rebase main
  1. What is a detached HEAD?
    A state where HEAD points to a specific commit, not a branch.

  2. How to rename a branch?

git branch -m old-name new-name
  1. How to delete local and remote branches?
git branch -d feature-x         # local
git push origin --delete feature-x   # remote
  1. 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

0
Subscribe to my newsletter

Read articles from Harshal Sonar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Harshal Sonar
Harshal Sonar