Skip to main content

Command Palette

Search for a command to run...

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

Published
5 min read
Day 9 Task: Deep Dive in Git & GitHub for DevOps Engineers
P

Hey there! I am Pradeep Chitroliya I am a Devops engineer, started writing articles on my DevOps and cloud journey. My purpose is to share the concepts that I learn, the projects that I build, and the tasks that I perform regarding DevOps. Hope you all find it useful.

🗼What is Git and why is it important?

Git is a distributed version control system used for tracking changes in source code during software development. It allows multiple developers to collaborate on a project and keep track of their work. Here are some key aspects of Git and why it is important:

  1. Version Control: Git allows developers to keep track of changes made to the code over time. It maintains a history of all the modifications, enabling users to revert to previous versions if necessary.

  2. Collaboration: Git facilitates collaboration among multiple developers working on the same project. It allows them to work on different features or branches simultaneously and then merge their changes back into the main codebase.

  3. Branching and Merging: Git enables developers to create multiple branches, which are independent lines of development. This feature allows for the isolation of new features or experiments without affecting the main codebase. Developers can later merge these branches back into the main codebase.

  4. Distributed Development: Git is a distributed version control system, which means that each developer has a complete copy of the code repository on their local machine. This allows developers to work offline and then sync their changes with the central repository when they are back online.

  5. Backup and Recovery: Git acts as a backup mechanism, ensuring that the code is not lost in case of system failures. Developers can easily recover the code from the Git repository if their local copies are lost or corrupted.

  6. Open Source Community: Git is widely used in the open-source community, making it easier for developers to contribute to various projects and share their work with others.

2.What is difference Between Main Branch and Master Branch??

The "main" branch in Git is the default branch that is created when you initialize a new Git repository. It serves as the primary line of development and typically represents the latest stable version of the project. Developers often work directly on the main branch or create feature branches from it for implementing new features or making changes.

The "master" branch in Git is the default branch that is created when you initialize a new Git repository. It is often considered the main branch and serves as the primary line of development for a project. Developers typically work directly on the master branch or create feature branches from it for implementing new features or making changes.

3. Can you explain the difference between Git and GitHub?

Git:

  • Git is a distributed version control system that allows developers to track changes in their source code during software development. It enables multiple developers to work on the same codebase simultaneously, providing features such as version control, branching, merging, and code collaboration.

  • It is a command-line tool that operates locally on the developer's machine, allowing them to create repositories, track changes, and manage versions of their code without the need for a centralized server.

    GitHub:

    • GitHub is a web-based platform that provides hosting for software development projects using Git. It serves as a platform for code hosting, version control, and collaboration. Developers can use GitHub to store their Git repositories in the cloud, making it easier to collaborate with others and manage their codebase.

    • It offers additional features such as issue tracking, pull requests, project management tools, and wikis, which facilitate collaboration among developers and project stakeholders.

    • GitHub also provides a social networking aspect, allowing developers to follow projects, contribute to open-source projects, and showcase their work to the community.

How do you create a new repository on GitHub?

  1. Sign in to your GitHub account. If you don't have one, you'll need to create an account first.

  2. Once you're signed in, click on the "+" icon in the top right corner of the GitHub interface. This will open a dropdown menu.

  3. From the dropdown menu, select "New repository."

  4. On the "Create a new repository" page, you'll need to provide the following information:

    • Repository name: Choose a name for your repository.

    • Description (optional): Add a brief description to provide context about your project.

    • Visibility: Choose whether you want the repository to be public or private. Public repositories are visible to everyone, while private repositories are only accessible to you and any collaborators you grant access to.

    • Initialize this repository with a README: If you want to add a README file to your repository, check this option.

  5. You can also choose to add a .gitignore file and a license to your repository, depending on your project's requirements.

  6. After you've filled in the necessary information, click the "Create repository" button.

Local Repository:

    • A local repository is the version of the project that resides on your local machine. It includes all the files, commits, branches, and project history. You can work on the code, make changes, and commit them to the local repository without needing an internet connection.

      • The local repository serves as the primary workspace where you make changes to the project before sharing them with others or pushing them to a remote repository.

Remote Repository:

    • A remote repository is a copy of the project that is hosted on a remote server, typically on a platform like GitHub, GitLab, or Bitbucket. It serves as a central location where multiple developers can collaborate on the same project. Remote repositories allow for easy sharing, collaboration, and backup of the project.

      • Developers can push their local changes to the remote repository and pull changes from it to their local repository to stay up to date with the latest version of the project.

🏗Task-1: Set your user name and email address, which will be associated with your commits.

Task02:-

  1. Create a repository named "Devops" on GitHub

  1. Connect your local repository to the repository on GitHub.

3. Create a new file in Devops/Git/Day-02.txt & add some content to it

More from this blog

Knowledge of DevOps and Cloud

57 posts

Hey there! I am Pradeep Chitroliya I am a Devops engineer, started writing articles on my DevOps and cloud journey. My purpose is to share the concepts that I learn, the projects that I build, and the