Day 9: Mastering Version Control with Git and GitHub

Adrian Rubico

|

Aug 30, 2024

10:48 PM GMT+8

As DevOps continues to grow, effective collaboration and efficient code management have become increasingly important. To achieve these goals, developers need tools like Git and GitHub. Our goal in this article is to offer a fundamental understanding of Git and GitHub, explaining their significance and how they fit into the landscape of Version Control Systems (VCS).

What is Git?

Git is an open-source distributed version control system for tracking changes to code repositories, collaborating with other developers, and maintaining a history of changes. In 2005, Linus Torvalds created Git, which became the most widely used version control system due to its speed, efficiency, and ability to manage small to large projects.

Why is Git Essential to DevOps?

In DevOps, Git facilitates seamless collaboration, continuous integration, and rapid deployment. While development and operations teams work closely together, Git enables the automation of processes, supports branching and merging strategies, and ensures everyone is on the same page with the latest code repository. Regarding maintaining the agility and reliability required in DevOps environments, Git is essential for rolling back changes, experimenting with new features in isolated branches, and integrating those changes smoothly into the main project. 

What is GitHub?

GitHub is a platform for hosting Git repositories and provides tools for collaboration and project management. It offers a user-friendly interface, which makes working with Git easier, especially in collaborative environments. In addition, it provides features such as pull requests, issue tracking, and CI/CD integration, making it a central point for open-source and enterprise projects.

What is a Version Control System (VCS)?

DNF is the newer package manager used on more recent RHEL-based distributions like Fedora. It replaces YUM while offering similar functionality but with improved performance and better dependency management.

Why VCS?

Using a VCS offers several advantages:

  • History and Backup: All code changes are recorded, providing a historical archive.
  • Collaboration: Multiple developers can work simultaneously on the same project.
  • Branching and Merging: Developers can create branches to work on new features or fixes separately, then merge them back into the main project.
  • Accountability: The VCS allows us to track who made specific changes, facilitating collaboration and accountability.

Distributed and Centralized VCS

  • Distributed VCS: In a distributed VCS, every developer has a full copy of the repository, including its entire history. In this way, more robust collaboration can be achieved and operations can move more quickly, since most tasks can be completed locally.
  • Centralized VCS: A centralized VCS stores all versions of files for a project on one server. These files are checked out from a central server, and the changes are committed back to it by developers. Although this model supports collaboration, it may have limitations in handling large projects due to its server dependency.

Why We Mostly Use Distributed VCS Over Centralized

Distributed Version Control Systems (DVCS), like Git, offer significant advantages over centralized systems:

  • No Single Point of Failure: Each developer has a copy of the repository, thus no central server is needed.
  • Faster Operations: Committing, branching, and merging are most commonly performed locally, which helps speed up processes.
  • Better Collaboration: Developers can collaborate independently and merge changes when ready, reducing conflicts and increasing productivity.
  • Flexibility: DVCS offers a more flexible workflow, allowing for features to be branched, pull requests and forks to be created.

What's Next?

In the next chapter of our #90DaysDevOpsChallenge, we'll explore practical exercises and tasks with Git. We will cover the basic commands of Git and how to apply them to real-world scenarios.

Discussion