Version Control Systems (VCS) - Mastering Git and GitHub

 










Introduction to Version Control Systems (VCS)

Version Control Systems (VCS) are essential tools in software development, enabling teams to track changes, collaborate efficiently, and maintain a history of modifications. Among various VCS, Git is the most widely used, often paired with GitHub for cloud-based repository hosting.

In this blog, we will cover:

  1. Introduction to Git and GitHub (2 Hours)
  2. Branching, Merging, and Rebasing (2 Hours)
  3. Git Workflows (GitFlow, Trunk-based development) (2 Hours)
  4. Hands-on GitHub Projects (2 Hours)

1. Introduction to Git and GitHub (2 Hours)

What is Git?

Git is a distributed version control system (DVCS) designed to handle projects efficiently, enabling developers to:

  • Track changes in source code.
  • Collaborate with teams.
  • Revert to previous versions if needed.

Why Use Git?

  • History Tracking: Easily revert changes.
  • Collaboration: Multiple developers can work simultaneously.
  • Branching and Merging: Experiment and integrate features efficiently.
  • Performance: Fast and lightweight.

What is GitHub?

GitHub is a cloud-based repository hosting service that enhances Git’s capabilities by providing:

  • Centralized repository storage.
  • Issue tracking and project management.
  • Continuous Integration (CI) and deployment support.
  • Community collaboration through pull requests and forks.

Installing Git and Initial Setup

To get started with Git, install it on your system:

sudo apt install git  # Ubuntu/Debian
yum install git       # CentOS/RHEL
brew install git      # macOS

Configuring Git:

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Basic Git Commands

Initializing a Repository

git init  # Initialize an empty Git repository

Cloning a Repository

git clone https://github.com/user/repository.git

Checking Repository Status

git status

Staging and Committing Changes

git add file.txt       # Stage a file
git commit -m "Added new feature"

Viewing Commit History

git log

2. Branching, Merging, and Rebasing (2 Hours)

What is Branching?

Branches allow developers to work on features independently without affecting the main codebase.

Creating a New Branch

git branch feature-branch

Switching Between Branches

git checkout feature-branch

Creating and Switching to a New Branch

git checkout -b new-feature

Merging Branches

Merging integrates changes from one branch into another.

git checkout main
git merge feature-branch

Rebasing a Branch

Rebasing moves changes from one branch onto another to keep a linear history.

git checkout feature-branch
git rebase main

3. Git Workflows (GitFlow, Trunk-based Development) (2 Hours)

1. GitFlow Workflow

GitFlow is a structured branching model suited for larger teams.

  • main – Stable production branch.
  • develop – Ongoing development branch.
  • feature/* – New features.
  • release/* – Pre-release testing.
  • hotfix/* – Urgent production fixes.

Example of GitFlow Branching

git checkout -b feature/new-ui develop
# Work on feature
git checkout develop
git merge feature/new-ui
git branch -d feature/new-ui

2. Trunk-Based Development

Trunk-based development involves:

  • A single main branch (trunk).
  • Short-lived feature branches.
  • Frequent integration (CI/CD).

This model is ideal for fast-moving teams focusing on continuous deployment.


4. Hands-on GitHub Projects (2 Hours)

1. Forking and Contributing to Open Source

Forking allows you to contribute to public repositories.

git clone https://github.com/opensource/project.git
git checkout -b my-fix

Make changes, then push and create a Pull Request (PR)!

2. Setting Up a Remote Repository

Create a repository on GitHub and connect it:

git remote add origin https://github.com/user/repository.git
git push -u origin main

3. Collaborating with Pull Requests (PRs)

  1. Push your feature branch:
    git push origin feature-branch
    
  2. Open a Pull Request on GitHub.
  3. Get feedback and merge changes.

Conclusion

Mastering Git and GitHub is a fundamental skill for DevOps engineers. Understanding branching strategies, Git workflows, and real-world collaboration ensures smooth software development. By practicing these concepts, you’ll be ready to work effectively in any DevOps team!

Next Steps: Start a GitHub project, experiment with branches, and contribute to an open-source repository! 🚀













🚀 Kickstart Your DevOps Career with Expert Guidance! ðŸš€

Want to break into DevOps but not sure where to start? Or looking to level up your skills in CI/CD, Kubernetes, Terraform, Cloud, and DevSecOps?

📢 Book a 1:1 session with Shyam Mohan K and get:
✅ A personalized DevOps roadmap tailored to your experience
✅ Hands-on guidance on real-world DevOps tools
✅ Tips on landing a DevOps job and interview preparation


📅 Click here to Book your session today! 👉   

#DevOps #CloudComputing #CICD #Kubernetes #AWS #Terraform #TechCareer #CareerGrowth #Learning #ITJobs



Comments

Popular posts from this blog

DevOps Learning Roadmap Beginner to Advanced

What is the Difference Between K3s and K3d

Lightweight Kubernetes Options for local development on an Ubuntu machine