Day 8 - Task: Basic Git & GitHub for DevOps Engineers (Dec 4, 2023)

Day 8 - Task: Basic Git & GitHub for DevOps Engineers (Dec 4, 2023)

Welcome back to our DevOps journey! Today, we dive into the world of version control systems, specifically focusing on Git and GitHub. As DevOps engineers, understanding version control is crucial for efficient collaboration and seamless project management.

What is Git?

Git is a powerful version control system that enables you to track changes to files and manage collaborative work among multiple team members. Originally designed for software development, Git has become a standard tool for any project that involves file changes over time. With Git, you can easily roll back to previous versions of files, see who made specific changes, and merge different contributions into a cohesive project.

What is GitHub?

GitHub, a web-based platform, hosts Git repositories and enhances Git's functionality with additional features. Owned by Microsoft, GitHub is widely used for version control and source code management. It's a hub for collaboration, providing tools for issue tracking, code review, and project management. GitHub is not only a hosting platform but also a social network for developers, making it easy to share and contribute to open-source projects.

Version Control: Centralized vs. Distributed

Version control systems (VCS) track changes to files over time, providing several benefits such as reverting to previous states, comparing changes, and identifying contributors. There are two main types of VCS: centralized and distributed.

  1. Centralized Version Control System (CVCS):

    • Uses a central server to store all versions.

    • Developers check out and check in files from/to the central server.

    • Examples: Subversion, Perforce.

  2. Distributed Version Control System (DVCS):

    • Allows developers to clone entire repositories, including history.

    • Developers work independently and later merge changes into the main repository.

    • Examples: Git, Mercurial, Darcs.

Why Choose Distributed Version Control?

1. Better Collaboration:

  • Every developer has a complete local copy, facilitating collaboration without constant communication with a central server.

2. Improved Speed:

  • Local copies enable faster commits and version control actions without the need to communicate with a central server.

3. Greater Flexibility:

  • Developers can work offline, commit changes later, and selectively share changes with specific team members.

4. Enhanced Security:

  • Multiple copies of the repository history improve data resilience, making it more resistant to data loss compared to CVCS.

In summary, the decentralized nature of DVCS provides greater collaboration, flexibility, and security, making it the preferred choice for many development teams.

Task: Getting Started with Git and GitHub

1. Install Git:

2. Create a GitHub Account:

3. Learn Git Basics:

  • Read through the official Git documentation or watch tutorials to grasp the basics of Git.

Exercises:

1. Create a New Repository on GitHub:

  • Log in to your GitHub account and create a new repository.

2. Clone Repository to Local Machine:

  • Use Git to clone the repository to your local machine.

3. Make Changes and Commit:

  • Modify a file within the repository, and commit the changes using Git.

4. Push Changes to GitHub:

  • Push the committed changes back to the GitHub repository.

Congratulations! You've taken your first steps into the world of Git and GitHub. These foundational skills will serve you well as you continue your journey into DevOps. Happy coding!