Sunday, March 3, 2024

Top 5 This Week


Related Posts

How to Install Git | Step by Step

What is Git?

Git is a distributed version control system (DVCS) or simply version control tool, that is essential in the collaborative software development environment.

Linus Torvalds created the system in 2005 to solve the issue of organizing source code among different authors. Git, unlike conventional version control systems, has a flexible approach that enables developers to work on projects independently while smoothly merging their changes.

Git maintains changes in source code at its heart, offering a thorough and fast tool for collaboration. Each developer has their own repository, which allows them to make changes, create branches, and test new features without impacting the main source.

Because developers may work offline and synchronize their changes with a central repository when ready, this decentralized process increases flexibility.

Git’s ability to manage branching and merging with extraordinary ease is one of its distinguishing qualities.

Branches provide discrete settings for individual activities or features, allowing for simultaneous development.

How to create account in Github

Open this Site click on Signup on the top right of your screen.

Master Git by Learning how to Install and Configure in Windows Step by Step

Enter your email ID, which you use for login purposes, and your desired password, as shown below.

How to Install and Configure Git in Windows Step by Step

Once you enter your Email ID and password, Click Continue it ask for Username Enter your username; next, it will ask if you would like to receive product updates and announcements. Via email? Simply put n if you don’t want to After that, for verifying your account, it will show a small puzzle that you must solve. Don’t worry, Its very easy. After you submit, you’ll receive GitHub launch code on your registered email address, which you used for creating account Put that code on the next screen, and post that you can skip the personalization.

And voila…!!! You have successfully created a GitHub account.

Lets visit our GitHub dashboard

How to Install and Configure Git in Windows Step by Step

Let’s create our first repository. As you see, there are two types of repositories showing.
Private and Public

To create a private repository, you should have a premium-level subscription for demo purposes; we do not need this We will go with public repository only Mention repository name and click Create Repository

How to Install and Configure Git in Windows Step by Step

As you can see, we created our first repository. Now let’s install Git for Windows to connect our first project to this repository. Goto Google and type git for windows

How to Install and Configure Git cli in Windows

Go to this URL: Download the Standalone installer for Windows. Choose the bit version as per your OS; in my case, I am selecting 64-bit. Once downloaded, click install and follow the steps You just need to click next

How to Configure and Install Git cli in Windows

Our Git successfully installed, Let verify it Open command prompt, PowerShell, or Gitbash are both fine. I am familiar with command prompts, so opening the command prompt In command prompt, type the command

git -v

If git is successfully installed, then you’ll see the version number of git, it means our git was successfully installed. Now let’s configure our source code location and initialize our repo path. Navigate to the folder where you want to create your project repo. In my case, its C:\Project You can follow this step.

Initializing the Repository

git init

Adding dummy file into that folder ( )

git add or  git add . 

Note : . command is used to add all files

 if you got this error

Author identity unknown
*** Please tell me who you are.
git config --global "" 
git config --global "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.

Simply run those suggestion

git config --global ""  ( add your email id here )
git config --global "Your Name"
( user userName)

Adding Commit

git commit -m "first commit"

Select Main branch

git branch -M main
git remote add origin <git project url> ( git remote add origin )

Pushing Changes to Main

git push -u origin main

First time prompt will appear to authenticate your credentials, select browser login method enter your GitHub credentials for authorization once login successful you’ll be able to push changes to our main remote branch like this

Let’s verify our changes successfully push or not to our remote branch Go to GitHub and refresh our repository which we created. You’ll see our first change here.

That’s great; you have successfully set up your first account and committed on GitHub.

Useful Commands

Create a new branch from the main/master branch.

git checkout main/master (first need to checkout branch from where you need to create branch)
git checkout -b <branchName>

How to save or draft local changes

Sometimes we need to save local changes without affecting the main or working branch. To achieve this, we need to use ‘git stash’ command.

git stash

when your work done and changes are good to go in working branch, first check the working or current branch

git checkout feature/branchName
git stash apply (this will apply your changes into feature or working branch)

Command to take all remote branches which are newly created in git

git remote update
(this command refreshes all the remote branches so you will be able to checkout any newly created remote branch)

Logs Command

git log ( all logs )
git log –oneline ( only single liner)

refer full list here

What is rebase

Rebase means taking remote changes into your local branch without losing or overriding local changes. It is recommended to always use the first rebase command.

git pull --rebase origin main

If you are facing a conflict issue while rebasing, then resolve the issue manually and trigger the command.

git rebase –skip ( To skip rebase )

git rebase –continue

Rename local branch

Let say you create local branch name abc_123 now you want to rename it to def_456

git branch -m abc_123 def_456 ( this will rename branch to def_456)

Deleting local branch

git branch -D <branchName> (First, checkout some other branch; then only you’ll be able to delete your branch for example.)

If you’re working in a branch and want to delete that, then you should first switch to branch B or main.

then only you can delete it.

Merge or Sync changes with remote main branch

If you are working on local branch and want to take latest from main, then first take rebase from your branch

And pull all changes from the main branch and trigger the merge command.

git checkout main ( shift to main branch for pulling changes )

git pull origin main ( this way local main branch is upto date)

git checkout featureBranch

git merge main

git commit -m “sync with main “

git push origin featurebranch


In summary, this blog post has comprehensively elucidated the requisite commands for installing and configuring GitHub, thereby guiding the reader through the essential procedures. Having adhered to the delineated guidelines, you are now endowed with the expertise necessary to effectively configure GitHub and exploit its robust functionalities for version control and collaboration. It is advisable to consult this guide periodically and investigate additional features on GitHub to optimize your development process.

Best wishes on your coding!

Atul Sirsode
Atul Sirsode
Hello Readers, Welcome to DigitalIndia18, my blogsite where I share insights, trends, and stories about the digital landscape in India. Join me on this exciting journey as we explore the intersection of technology, innovation, and culture. Let's connect and stay updated! #DigitalIndia #TechTrends #Innovation

Popular Articles