Introduction to Git.

Harsh Seksaria
Version Control System, Git and GitHub
6 min readJan 21, 2021

--

Hey there! Hope you’re doing well.

We saw the different Version Control System types in the last blog, which are local, centralized, and distributed. The Distributed Version Control System is the most widely used, and “Git” the most pursued tool. In this and next blogs, we will know more about Git, git commands, what they mean, and how to use them. We will also learn how to use GitHub, a remote repository provider for the version control system.

Git is an open-source distributed version control system that is available for free. It offers lightning-fast performance. Git can handle small to extensive projects without the worry of speed or performance, and it is easy to learn. Git offers the following benefits:

  1. Free and Open-Source: Git was released under GNU General Public License version 2.0 to offer us the freedom to share and change the free software.
  2. Distributed: Every developer has their own copy for editing and committing changes.
  3. Small and Fast: Most of the operations on Git is performed locally. That's why it is so fast. Installing Git on a system doesn't take much space and does not demand high computing powers.
    Linus Torvalds created Git in 2005 to manage code when he was developing the Linux kernel. So, Git was supposed to handle and maintain large code from the beginning itself. That's why it is so robust and efficient.
  4. Staging Area: Git offers something called a staging area where you can review your changes before committing them. You can also stage only some of the files rather than all the modified files and commit them.
  5. Branching and Merging: You can create multiple branches from an existing branch to modify code or parts of code. Branches are completely unrelated and are independent of each other. We can create a copy of an existing branch, modify it and then even merge the changes back to the branch it was created from. It lets you experiment without affecting the main branch it was created from.
  6. Data Assurance: Git keeps your code safe and maintains encryption using checksums. There is a little bit of complexity in understanding how git commit ids work and how you can edit anything already committed.

Click here for the reference link.

Installing Git

Git comes pre-installed in some systems but also may not be in many systems. You can easily install it from its official website.

Step 1: Go to the link embedded above and click on whatever system you are using. I am going to install it for Windows.

System options screenshot
Select whichever is applicable.

When you click on your system preference, the new page will open, and the download will start automatically. In case it doesn’t, click on your relevant system’s bit and download.

Step 2: Open the downloaded file.

Step 3: When asked to allow to let it make changes on Windows, click Yes.

Step 4:Click on next when you see the license page.

License Page Screenshot
Click “Next”

Some of you may already have git installed, so you may be asked with options to update the existing version. Select options you find suitable for your needs.

Step 5: If you want to change the folder where git installs, click “Browse” and select destination, and then click “Next”.

Install location screenshot
Change the destination to install if you want, and then click “Next”.

Step 6: In the next options, you may leave the selections to default or make changes if necessary. I would suggest keeping both options for Windows Explorer Integration as you may need them from time to time. But make sure to have at least the Git Bash Here option checked as it comes in very handy to get Git console.

Select components screenshot
Check other options if you want, and click “Next”

Step 7: You can leave the Start Menu folder name default or change it. You can also choose to not create it by checking the box on the bottom left side. Then click “Next”.

Start Menu folder name screenshot

Step 8: Now, you can choose whatever editor you like from the options given in the dropdown box. Then click “Next”.

Choose editor screenshot

Step 9: You should pay a little more attention to this step. Previously, when you create a Git repo, the default branch used to be “master”. But now things are changing, and people are using “main” instead of “master”. Even when you create a new repo in GitHub and initialize with README or anything else, it gets committed in the “main” branch. So you can either use master or main; both are fine and doesn't affect how you interact with GitHub. Here, I’m choosing to switch to “main” by clicking on the override option so that when I create local repositories, they are initialized with “main” as the default branch.

Default branch name selection screenshot

Step 10: Here, we are given 3 options.

The first option means you can use Git only through Git Bash(Step 6). Choosing the second option lets you commit changes even from 3rd party software like code editors, Microsoft Visual Studio, Android Studio, etc. And that is why I suggest this option. The third option is a little complicated, and I recommend choosing only if you properly understand the changes that will happen in your OS. Then click “Next”.

Adjusting PATH environment screenshot

Step 11: Leave the default selection and click “Next”

Use OpenSSL option screenshot

Step 12: If you are using a Windows pc, use the option selected in the screenshot. If you are using a Unix system, use the second option.

Line ending configs screenshot

Step 13: Leave the default selection and continue.

Make sure you have “Use MinTTy” selected.

Step 14: Leave the selection as “Default” and click “Next”.

Default behaviour of git pull screenshot

Step 15: Leave the default selection for the credential manager and click “Next”.

Credential helper selection screenshot

Step 16: Leave the default selection and continue.

File caching option screenshot

Step 17: You can choose to select or not select the option given. And click on “Install”.

Step 18: You will see the progress as Git installs in your system.

Install progress screenshot

Step 19: Click “Finish”.

Congrats! You installed Git and are now ready to start managing versions of your code. Wooohoooo!

One more thing. You can verify if Git has been properly installed. Right-click anywhere on the desktop, and you should see an option as “Git Bash Here”. Click that. Now, write the following command and press enter on your keyboard.

git --version

If Git has been installed properly, you must get the version number, whichever you have installed.

Output of git version command
The output from the command given above.

In the next blog, we will start with basic git commands and prepare a folder to manage files. Till then, have a nice time learning.

Thank you.

My name is Harsh Seksaria. I like to write about the topics simplifying them as much as possible for you to understand without unnecessary effort. Still, sometimes something may not be very clear. If you find any mistake, error, or you have a suggestion, just mail me. I’ll try to improve it asap.

My email: harsh20.freelance@gmail.com

My LinkedIn: www.linkedin.com/in/harshseksaria

--

--

Harsh Seksaria
Version Control System, Git and GitHub

MSc Data Science @ Christ (Deemed to be University), Bangalore, INDIA