Day 8 : Basic Git & GitHub for DevOps Engineers.

ยท

4 min read

  1. What is Git?

Git provides a decentralized repository where each contributor has a local copy of the entire project. Changes are tracked through commits, creating a detailed history that can be merged and shared among team members. This ensures a robust and collaborative development process.

Full Stack Development the Top 14 Open Source Tools โ€ข INFOLOB Global

  1. What is Github?

GitHub is a web-based platform that hosts and manages version-controlled projects using Git. It provides a collaborative space for developers to store, share, and work on code. GitHub offers features like issue tracking, pull requests, and collaboration tools, making it a central hub for team-based software development.

  1. What is Version Control? How many types of version controls we have?

Version control is like having a super-smart assistant that remembers every change you make to your project. It helps you undo mistakes or go back to earlier versions. There are mainly three types:

  1. Local Version Control:

    • Saving different versions on your computer, like keeping multiple drafts of your story just for yourself.
  2. Centralized Version Control:

    • Imagine a shared library where all your friends can access and work on the same project together. It's like a shared space for collaboration.
  3. Distributed Version Control:

    • You and your friend have your copies of the comic book project. You work separately but can still share and combine your ideas. It's like having your creative space while being part of a bigger team.
  4. Why we use distributed version control over centralized version control?

Advantages of Distributed Version Control over Centralized:

  1. Flexibility:

    • Distributed Version Control (DVC) allows contributors to work offline and independently. They can make changes, create branches, and commit without needing constant connection to a central server.
  2. Collaboration:

    • DVC supports more effective collaboration. Team members can work on different aspects simultaneously, merging their changes later. It's like each contributor having their playground.
  3. Redundancy:

    • Every team member has a complete copy of the project, providing redundancy. If the central server fails, the project is still accessible from individual copies.
  4. Branching and Merging:

    • DVC excels in branching and merging. Developers can create branches for new features or bug fixes without affecting the main project until ready.

Flaws of Centralized Version Control:

  1. Dependency on Central Server:

    • In Centralized Version Control (CVC), the central server is a single point of failure. If it goes down, collaborators may face difficulties accessing or updating the project.
  2. Limited Offline Functionality:

    • CVC often requires a continuous network connection. Working offline or in areas with poor connectivity can hinder the development process.
  3. Branching Challenges:

    • Branching and merging in CVC can be more challenging and may require more manual effort. This makes it less flexible when it comes to parallel development.
  4. Scalability Issues:

    • As the team and project size grow, CVC systems may encounter scalability issues. Managing large projects with numerous contributors can become cumbersome.

Here is a Demo how to clone and commit changes on GitHub using Git.

A Step-by-Step process:

So, here I am, ready to embark on my GitHub journey! I've got my commands lined up, and I'm eager to create, commit, and push changes to my very own repository. Let's dive in:

Step 1: Clone the Repository

git clone https://github.com/theyashsisodiya/DevOps.git

First things first! I've cloned my repository named "DevOps" from GitHub to my local machine.

Step 2: Explore the Repository

ls
cd DevOps
ls

Let's take a look around. Using these commands, I navigated into the cloned repository and checked what's inside. It seems pretty empty for now.

Step 3: Create Some Files

touch file{1..10}.txt
ls

Time to add a bit of substance! I've created 10 text files using a nifty command. Now, my repository isn't looking so bare anymore.

Step 4: Add, Commit, and Push

git add .
git commit -m "Committing 10 files to GitHub repo as a task"
git push origin main

Alright, the grand finale! I've added my changes, committed them with a fancy message, and pushed everything back to GitHub.

ย