Day9: Exploring Git and GitHub for DevOps

Day9: Exploring Git and GitHub for DevOps

ยท

3 min read

For Better Understanding of Git and GitHub

What is Git and Why is it important?

Git is a distributed version control system that plays a crucial role in modern software development. It is used to track the changes in code and allow multiple developers to collaborate, manage and maintain software projects. It is very useful for team collaboration and project management.

Git is very useful because it makes it easy for a developer to track changes in code, and manage projects. It simplifies the branching, merging and sharing of code and improves team productivity.

What is the difference between the main branch and the master branch?

The main difference between the "main" branch and the "master" branch is mainly the matter of terminology. Git used "master" as the default branch name and GitHub used "main" as the default branch name.

Historically, the term "master" has been criticized as a potentially insensitive connotation, and many projects and organizations moved away from using it. "Main" is an alternative term to define the "master" branch in a modern way. It serves the same purpose as the "master" branch.

Both "main" and "master" fulfil the same role in Git, representing the primary line of development in a repository.

What is the difference between Git and GitHub?

  1. Git:

    • Git is a distributed version control system.

    • It's software that helps you track changes in your code.

    • You can use Git on your computer without the internet.

    • Git doesn't require a specific platform or service.

    • It's used for version control and collaboration.

  2. GitHub:

    • GitHub is a web-based platform.

    • It hosts Git repositories in the cloud.

    • You need the internet to access GitHub.

    • GitHub provides additional features like issue tracking, pull requests, and collaboration tools.

    • It's often used for sharing open-source projects and collaborating with others.

How to create a new repository in GitHub?

If you don't know how to create a new repository in Github, you might missed the previous blog which has step-by-step instructions about how to create a new repository. Here is a link to the previous blog:

https://opsandcloud.hashnode.dev/day8-git-and-github-for-devops-90daysofdevops

What is the difference between the local and remote repositories and how to connect them?

  1. Local repository:

    • The repository on your computer system is known as the local repository.

    • The local repository is private by default, only you can access the local repository.

    • You can work directly with the local repository.

  2. Remote repository:

    • The repository is hosted on a remote server such as GitHub.

    • Multiple people can access and contribute to the remote repository.

    • It allows secure storage for your code and provides many features like pull request and issue tracking.

  3. How to connect or clone the repository:

    If you don't know how to connect or clone, read my previous blog for step-by-step instructions:

    https://opsandcloud.hashnode.dev/day8-git-and-github-for-devops-90daysofdevops

Set username and email associated with your commits

To set your username and email which will be associated with your commits, follow the steps below:

  • Open your terminal or command prompt, and use the git config --global username "[your_username]" command to set your username.

  • Use the git config --global email "[your_email]" command to set your email.

  • To verify that your username and email have been set correctly, use the git config --global --list command to check.

Your Task to do:

  • Create a repository named "Devops" on GitHub

  • Connect your local repository to the repository on GitHub.

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

  • Push your local commits to the repository on GitHub

If you have trouble doing any of the tasks above go read the previous blog of "day8". There's a complete step-by-step guide. Best of Luck for your task.

<Thank you for reading my blog till THE END. Join the journey by following me>

ย