What is Git

Blog
Spread the love

Git and GitHub are not the same thing. Git is an open-source, version control tool created in 2005.

It is designed to handle minor to major projects with high speed and efficiency. It is developed to co-ordinate the work among the developers. The version control allows us to track and work together with our team members at the same workspace. Git can be used privately and publicly.

Benefits of Git

A version control application allows us to keep track of all the changes that we make in the files of our project. Every time we make changes in files of an existing project, we can push those changes to a repository. Other developers are allowed to pull your changes from the repository and continue to work with the updates that you added to the project files.

What is repository in Git

A Git repository tracks and saves the history of all changes made to the files in a Git project. It saves this data in a directory called .git, also known as the repository folder.

How to Create repository.

First we need to create the account on GitHub, after that we need to create Repository, where we can push our code or put our project. We can create repository Public or Private as per our requirements.

Bluethinkinc Git
Bluethinkinc Git

How we can Clone a Repository

There is a command to clone the repository.

git clone [url]

[URL] – The URL of the Git repository you want to clone.

Configuring Repositories

After cloning the repository, we need to also set the author name and author email.

To add an author name to all the commits in the current repository:

git config –global user.name “[your_name]”

To add an email address to all the commits by the current user:

git config –global user.email “[email_address]”

How to Create the Branch from another branch on Local

To create the branch from another branch.

git checkout -b [“branch name”]

[“branch name”]: The name of the branch

How to add the file or folder in current directory.

To add all the files in the current directory to the staging area:

git add .

If you want to add the specific file or folder.

git add [file/folder path]

How to commit the code

Once you’ve added all the necessary files to the staging area, commit the changes to the repository by using:

git commit -m “Provide some Commit Message”

-m: Allows you to attach a message to the command

How to push the code

Git allows you to copy and share code with other developers by using the git push and git pull commands.

The git push command lets you share all the commits and files in the current repository with one or more remote repositories. The git push command uses the following syntax:

git push origin [branch name]

[branch name]: The name of the branch of your local repository you want to share.

bluethinkinc_blog

bluethinkinc_blog

2022-08-09

0

Leave a Reply

Your email address will not be published. Required fields are marked *

Find More Blogs

Exception Handling in Java

Spread the love Introduction – Exception:An unwanted

How to add custom less file in Magento2

Spread the love Source files *.css included into layout

Spring Boot Microservices

Spread the love Microservices architecture has become

Implementation of WireMock for better testing

Spread the love WireMock is a flexible and powerful tool

Magento 2: How to selected default option in configurable options?

Spread the love Configurable products in Magento 2 allow

How To Implement Simple JWT Authentication in Django Rest Framework

Spread the love We’ll learn how to use simple JWT

Optimizing Search: Integrating Elasticsearch in Django Applications

Spread the love What is Elasticsearch? Elasticsearch is a

How to create Customer Segments

Spread the love In Magento 2, “customer

Proxy Design Pattern and Requisition List in Magento 2

Spread the love Requisition List in Magento 2 Requisition

Google Ads Conversion Tracking Through Magento Platform:

Spread the love Google Ads Conversion Tracking Through

bluethinkinc Blogs