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

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

(1) What is Git and why is it important?

Git is a free and open-source version control system that is used to track changes in software development projects. It was created by Linus Torvalds in 2005 to help manage the development of the Linux kernel, but it has since become one of the most widely used version control systems in the world.

Git is important because it allows developers to keep track of changes to their code over time, collaborate with others on projects, and easily revert to previous versions of code if necessary. By using Git, developers can work on the same project without interfering with each other's code, and they can easily merge changes from multiple sources into a single codebase.

Git also makes it easier to manage complex software projects by providing tools for branching and merging code, which allows developers to work on separate features or bug fixes without affecting the main codebase. This can be especially useful for large teams or projects with multiple contributors.

Overall, Git has become an essential tool for software development and is widely used in both open-source and commercial software projects.

(2)What is the difference Between Main Branch and Master Branch??

In Git, the terms "main branch" and "master branch" are often used interchangeably, but they can have slightly different meanings depending on the context and the organization that is using them.

In terms of functionality, there is no difference between a "master" branch and a "main" branch in Git. Both are simply the default branch that is created when you initialize a new Git repository, and both can be used to track the mainline development of your code.

If you are working on a project that uses Git, it is important to check the conventions and policies of the organization you are working with to determine which branch name they prefer to use. Some organizations may have specific naming conventions or workflows that they use to manage their code repositories, and it is important to follow these conventions to avoid confusion and ensure that your code is integrated smoothly with the rest of the project.

(3) Can you explain the difference between Git and GitHub?

Git and GitHub are often used together, but they are not the same thing. Git is a version control system, while GitHub is a web-based platform that provides a hosting service for Git repositories.

Git is a command-line tool that allows developers to manage their code changes locally. It provides a way to track changes to code over time, collaborate with others on projects, and manage complex software projects. Git is a distributed version control system, which means that each developer has their own copy of the code repository and can work on changes independently before merging them with the main codebase.

GitHub, on the other hand, is a web-based platform that provides a centralized location for hosting and managing Git repositories. GitHub makes it easy to share code with others, collaborate on projects, and manage software development workflows. It provides features like issue tracking, pull requests, and code reviews, which can help teams manage their development process more efficiently.

While Git can be used independently of GitHub, GitHub relies on Git as its underlying version control system. When you use GitHub, you are essentially using Git with the added benefits of a web-based interface and collaboration tools.

(4) How do you create a new repository on GitHub?

we need to click on + symbol

then enter your repository name and click on create .

(5) What is difference between local & remote repository? How to connect local to remote?

A local repository is a version control system that is stored on your local computer. It contains all the files and versions of those files that you are working on. On the other hand, a remote repository is a version control system that is hosted on a remote server, which allows you to collaborate with other developers and share your work.

git remote add origin https://github.com/username/repo.git

git push origin master

Task-1:

  • Set your user name and email address, which will be associated with your commits.

      git config --global user.name <name>
    
      git config --global user.email <email>
    

Task-2:

  • 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

create repository on github

copied the link from here

Done

Thanks for Reading

my github :-