DEV Community

Cover image for Day 12: Deep Dive in Git & GitHub for DevOps Engineers
Udoh Deborah
Udoh Deborah

Posted on

Day 12: Deep Dive in Git & GitHub for DevOps Engineers

Getting Started with Git and GitHub – A Beginner's Guide

Whether you're a developer, DevOps engineer, or student, understanding Git and GitHub is essential to working with code collaboratively and safely. In this post, I’ll walk you through the basics using simple explanations and handmade-style diagrams.


What Is Git and Why Is It Important?

Git is a version control system. Think of it as a time machine for your code. Every time you make changes, Git lets you:

  • Save snapshots (called commits)
  • Go back to earlier versions
  • Collaborate with others without overwriting their work

Why it matters:

  • Track changes
  • Collaborate on projects
  • Reduce the risk of losing work

🌱 Main Branch vs Master Branch

Both refer to the default branch in a Git repository. Historically, it was called master, but today most tools use main to encourage more inclusive language


🆚 Git vs GitHub

Feature Git GitHub
Type Tool (installed locally) Platform (online)
Purpose Version control system Host for Git repositories
Usage Works offline Needs internet connection
Command line Yes No (but has CLI support)

📦 How to Create a GitHub Repository

  1. Go to https://github.com
  2. Click New to create a new repo
  3. Name it (e.g., DevOps)
  4. Choose public/private, add README if needed
  5. Click Create Repository

🔁 Local vs Remote Repositories

  • Local repository: On your computer
  • Remote repository: Hosted on GitHub

To sync both:

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

Tasks Walkthrough

✅ Task 1: Set Username and Email

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

These details will appear in your commits.


✅ Task 2: Create and Connect to GitHub

  1. On GitHub, create a repo called DevOps.
  2. On your terminal:
mkdir DevOps
cd DevOps
git init
git remote add origin https://github.com/your-username/DevOps.git
Enter fullscreen mode Exit fullscreen mode

✅ Task 3: Add and Push a File

mkdir -p Git
echo "My Git journey begins!" > Git/Day-02.txt
git add .
git commit -m "Add Day-02 Git task"
git push -u origin main
Enter fullscreen mode Exit fullscreen mode

we have now created a file locally and pushed it to GitHub.


Final Thoughts

Learning Git can seem overwhelming, but with practice and visuals, it becomes second nature. Version control is a must-have skill in the tech

Stay tuned for more DevOps tools in this journey!

Top comments (0)