Day 8 : Basic Git & GitHub for DevOps Engineers.
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.
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.
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:
Local Version Control:
- Saving different versions on your computer, like keeping multiple drafts of your story just for yourself.
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.
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.
Why we use distributed version control over centralized version control?
Advantages of Distributed Version Control over Centralized:
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.
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.
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.
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:
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.
Limited Offline Functionality:
- CVC often requires a continuous network connection. Working offline or in areas with poor connectivity can hinder the development process.
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.
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.
Subscribe to my newsletter
Read articles from Yashraj Singh Sisodiya directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Yashraj Singh Sisodiya
Yashraj Singh Sisodiya
I am Yashraj Singh Sisodiya, a 3rd Year CSE student at SVVV, born and raised in Shujalpur. Currently residing in Indore, I'm passionate about pursuing a career in DevOps engineering. My tech journey began with an internship at Infobyte, honing my skills as an Android Developer intern. Alongside my academic pursuits, I actively participate in co-curriculars, holding roles as Technical Lead at Abhyudaya and Cloud Lead at GDSC SVVV, while also serving as an MLSA of my college. I have a keen interest in Cloud Computing, demonstrated through projects such as User management and Backup using shell scripting Linux, Dockerizing applications, CI/CD with Jenkins, and deploying a 3-tier application on AWS. Always eager to learn, I'm committed to expanding my knowledge and skills in the ever-evolving tech landscape.