Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers.

Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers.

🔦Git & Github Deep dive🔦

·

3 min read

đź’ˇWhat is Git and why is it important?đź’ˇ
Certainly! Git and GitHub are essential tools for version control and collaboration in software development. As a DevOps engineer, understanding these tools is crucial for managing code, collaborating with team members, and automating deployment processes. Let's go through some basic concepts and commands.

Below are the commands for the GIT:

I have created the folder called through mkdir command

#mkdir devops-batch5.1

So, this folder is still in the filesystem & not in the VCS

To do that we have to execute the command “git init “ within that folder (/devops-batch5.1)

TIP: Always remember that execute “git init” command within the folder only

Git Status: Through git status, Git provides a summary of changes, showing which files are modified, untracked, or staged for the next commit. Why is showing the below error?

Because we didn’t execute “Git init” command to make act this directory as a GIT repository

Git init : The git init command is used to initialize a new Git repository. When you run this command in a directory, it sets up the necessary data structures and files to start tracking changes in that directory.

Post executed the command Git init, We can check with Git status command:

.git folder: This .git folder is crucial because it contains all the internal data structures and configuration files that Git uses to manage version control for your project. This is a hidden folder.

So, we have created a file called Project.txt in the folder devops-batch5.1

To Untrack to track the file system we can use “git add “command

It’s Green now the file is in a tracked state.

To get the back file into in the untracked state we can use command “git rm --cached project.txt”

Git Commit command: Git command is using with -m (message)

Once your changes are staged, you can commit them using the git commit

we need to configure user name and user email id : git config --global user.name

Amit" and git config --global user.email

"abc@gmail.com"

Git log command: To see what are changes we made git log or git log --oneline or git log –pretty

Git help is also a useful command once executed this shows multiple commands with explanations:

What is the difference Between Main Branch and Master Branch??

Master Branch:

Historical Usage: "Master" has been a common default branch name in many version control systems and Git repositories.

Transition: In recent years, there has been a move in the tech industry to promote more inclusive and neutral language.

Impact: Some projects and organizations have chosen to rename their default branch from "master" to "main" to align with these goals.

Main Branch:

Alternative: "Main" is an alternative default branch name that is gaining popularity as a replacement for "master."

Inclusivity: The change is often framed as part of an effort to make the language in the tech industry more inclusive and avoid potentially negative historical connotations associated with the term "master."

Transition: Some version control platforms, like GitHub, have adopted "main" as the default branch name for new repositories.

Happy Learning !!

Â