#day14 Git and Git HUB

What is Git and why is it important?

Git Tutorial - javatpoint

Git is a version control system that helps developers track changes to their code over time, collaborate with others, and manage multiple versions of a project. It's important because it provides a structured approach to software development, making it easier to manage and collaborate on code.

What is difference Between Main Branch and Master Branch??

5 steps to change GitHub default branch from master to main | R-bloggers

In practical terms, the difference between the "main" and "master" branch is largely a matter of convention and preference. Some developers and organizations prefer to use "main" to refer to the default branch, while others continue to use "master".

Regardless of which term is used, the default branch is typically where the latest stable version of the codebase is stored, and other branches are created off of it for experimental features or bug fixes.

Can you explain the difference between Git and GitHub?

Git vs GitHub - javatpoint

Git and GitHub are related but different tools. Git is a version control system that allows developers to track changes to their code over time and collaborate with others on the same codebase. It is a command-line tool that can be used locally on a developer's computer.

On the other hand, GitHub is a web-based hosting service for Git repositories. It provides a platform for developers to store their Git repositories in the cloud, collaborate with others, and share their code with the wider community.

How do you create a new repository on GitHub?

To create a new repository on GitHub, follow these steps:

  1. Log in to your GitHub account.

  2. Click on the "+" icon in the top right corner of the page.

  3. Select "New repository" from the dropdown menu.

  4. Enter a name for your repository.

  5. Add a description if you like (optional).

  6. Choose whether you want the repository to be public or private.

  7. Select the checkbox to "Initialize this repository with a README" (optional).

  8. Choose a license if you like (optional).

  9. Click "Create repository".

Difference between git init and git clone?

Git init will create an empty git repository whereas git clone, an already created repository will copy to your local.

What is the difference between local & remote repositories? How to connect locally remotely?

Basic Git Commands With Examples [+Cheat Sheet]

A local repository is a copy of a Git repository that is stored on your own computer, while a remote repository is a copy that is stored on a remote server or hosting service, such as GitHub.

TASKS:

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

Create a repository named "devops_batch_3" on GitHub:

Connect your local repository to the repository on GitHub.

At first, Go to your Repository and copy the URL :

To check the remote connection of local repo

Linking the local repo to the remote repository

Create a repo with the same name in the git hub and link it to each other.

git remote add origin <URL>

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

At First Clone this Repo into your local machine:

COPY

git clone <URL>

Create a file in Devops/Git:

Commit it :

COPY

git commit -m "<your message"

Push your local commits to the repository on GitHub:

COPY

git push -u origin <present branch>

you can check it : git branch

You can check it on your Github Account: