#90DaysOfDevops | Day 12

Day 12 -> Git & GitHub for DevOps Engineers

#90DaysOfDevops  | Day 12

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:

Copy

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

Happy Learning !!