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

Salesforce Admin

Spread the love In our last blog, we discussed common

Unlocking AI with Spring Boot: Real-World Use Cases and Solutions

Spread the love Artificial Intelligence (AI) has moved from

Enhancing Performance with Reactive Java: A Beginner-Friendly Guide

Spread the love In today’s fast-paced software

Integrating Azure Function with Dynamics 365

Spread the love Signup on azure portal and make sure to

How to Create a Power Apps Component Framework (PCF) with React

Spread the love If youʼve been looking to supercharge your

Customize lead qualification for a seamless experience

Spread the love When the 2024 Release Wave 2 was launched,

Create a Custom Console Command in Spryker

Spread the love In Spryker, developers can create custom

SALESFORCE

Spread the love Salesforce is a cloud-based software

CRUD Operation in Spryker Backoffice with a Custom Module

Spread the love Spryker is a highly flexible and modular

How to create custom module on Spryker for Backoffice?

Spread the love Creating a custom module in Spryker

bluethinkinc Blogs