Deep Dive in Git & GitHub for DevOps Engineers #Day-12

Nikunj VaishnavNikunj Vaishnav
4 min read

What is a Version Control System?

A Version Control System (VCS) is a tool that helps you manage changes to your code over time. It allows you to keep track of every modification, revert to previous versions, and collaborate with others effectively.

Distributed Version Control System (DVCS)

DVCS stores the complete history of the project on every user’s computer. Git and Mercurial are popular examples. This enables multiple developers to work on a project simultaneously without relying on a central server.

Centralized Version Control System (CVCS)

CVCS uses a single server to store all versions of a project’s files. Clients check out files from this central place. Examples include Subversion (SVN) and Perforce.

Local Version Control System (LVCS)

In LVCS, all the changes are stored in a local database on your computer. It’s simple but lacks the ability to collaborate with others efficiently.

What is Git and why is it important?

Git is a distributed version control system that allows multiple developers to work on the same project efficiently. It keeps track of all changes and provides powerful tools to manage code history and collaboration.

Git is essential for modern software development because it provides an efficient way to manage code changes, collaborate with others, and maintain a history of all modifications. It enhances productivity and ensures code quality.

What is the difference between Main Branch and Master Branch?

Traditionally, the default branch in Git was called master. However, many projects now use main as the default branch to avoid terminology with potentially negative connotations. Functionally, they are the same.

Can you explain the difference between Git and GitHub?

Git is a version control system that you install and run locally on your computer. GitHub is a web-based platform that hosts Git repositories, providing a visual interface and additional collaboration features.

How do you create a new repository on GitHub?

  1. Go to GitHub and log in.

  2. Click on the “+” icon in the upper-right corner and select “New repository.”

  3. Enter a repository name and description.

  4. Choose to make it public or private.

  5. Click “Create repository.”

What is the difference between a local & remote repository? How to connect local to remote?

A local repository exists on your computer, while a remote repository is hosted on a server like GitHub. To connect a local repository to a remote one, you use the git remote add command followed by the remote repository’s URL.

Why Use DVCS Over CVCS?

Better Collaboration

In DVCS, every developer has the full history of the project. This makes it easier to collaborate without relying on a single server.

Greater Flexibility

DVCS allows developers to work offline and still commit changes. They can later push their changes to the central repository when they are back online.

Faster Operations

Operations like commits, diffs, and merges are faster in DVCS because they are performed locally.

Time Savings

Developers can work simultaneously on different parts of the project, reducing waiting times.

Enhanced Security

With DVCS, every copy of the repository contains the entire history. This redundancy provides a backup in case the central server fails.

Tasks

Task 1: Set Your User Name and Email Address

git config --global user.name "Nikunj Vaishnav"
git config --global user.email "nikunj.devcloud@gmail.com"

Task 2: Create a Repository Named "DevOps" on GitHub

  1. Follow the steps above to create a new repository on GitHub named "DevOps."

  2. On your local machine, initialize a Git repository:

mkdir DevOps
cd DevOps
git init

  1. Connect your local repository to the remote repository on GitHub:
git remote add origin https://github.com/nikunjdevcloud/DevOps

  1. Create a new file and add content:
mkdir -p Git
echo "This is Day 02 task" > Git/Day-02.txt

  1. Add the file to the staging area, commit, and push to GitHub:
git add .
git commit -m "Add Day-02.txt"
git push origin master

Conclusion

Understanding Git and GitHub is crucial for DevOps engineers. These tools facilitate efficient code management, collaboration, and version control, which are essential for modern software development. By mastering Git commands and GitHub workflows, you can enhance your productivity, maintain high code quality, and work seamlessly with other developers. Whether you are setting up repositories, managing branches, or pushing changes, these skills are fundamental to your success in the DevOps field.

Thanks for reading. Happy Learning !!

Connect and Follow Me On Socials :

LinkedIn | Twitter | GitHub

Like👍 | Share📲 | Comment💭

0
Subscribe to my newsletter

Read articles from Nikunj Vaishnav directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nikunj Vaishnav
Nikunj Vaishnav

👋 Hi there! I'm Nikunj Vaishnav, a passionate QA engineer Cloud, and DevOps. I thrive on exploring new technologies and sharing my journey through code. From designing cloud infrastructures to ensuring software quality, I'm deeply involved in CI/CD pipelines, automated testing, and containerization with Docker. I'm always eager to grow in the ever-evolving fields of Software Testing, Cloud and DevOps. My goal is to simplify complex concepts, offer practical tips on automation and testing, and inspire others in the tech community. Let's connect, learn, and build high-quality software together! 📝 Check out my blog for tutorials and insights on cloud infrastructure, QA best practices, and DevOps. Feel free to reach out – I’m always open to discussions, collaborations, and feedback!