A beginner's guide to understanding git and how to work with it.

A beginner's guide to understanding git and how to work with it.

Prerequisites

To successfully work with Git and install it on windows, you will need:

  • A windows device (computer)

  • Data

  • Good internet connection

Introduction

Git is a well-known open source management tool used to coordinate and handle different versions of small to very large projects among programmers.

Building software is a series of small milestones where each milestone is just about writing codes into a bunch of files stored in folders in your device and uploaded to a cloud storage system. In this article, you will understand the basis of Git and learn how to install it in your system.

What is git?

Git is more like a control panel that tracks changes in any set of computer files. It is a free open source distribution system designed to manage small and large projects efficiently. It enables a non-linear workflow as users can work on any project from any location globally.

It is an incredibly important tool to programmers working on open source projects using different programming languages like python, c++ etc. It excellent support for branching, merging, collab, rewriting project history, has brought about many innovative and excellent workflow.

How git works

Think of git as a diary book that keeps record of all your daily activity. If you are working on a set together, one person may be incharge of updating photos and the other may be incharge of updating text.

Example

A Fintech let's say flutterwave, is to be integrated into an e-commerce website, quite a number of people will be assigned to handle different part of the project. So, while one fellow is working on the structure (HTML codes), the other may be working on CSS and another may be designing the front-end and back-end. On completion of each part of the project, they'll all upload their codes to a folder in the cloud pending review. If satisfaction is not met during review, what will the team do? They'll have to go back and fix what was corrected. Will they have to rewrite the code? Now this is where Git comes to play. If they had used Git to save, then each changes made is saved automatically to a different save point but the main file isn't affected. But if no error or correction is made, it can be transferred to the main folder.

Working with git makes it easy for developers to collaborate and work with others through sharing code files.

Working with git, we have a master branch (i.e the main file). So, from the beginning of your project, as you make changes they'll appear along as branch files. Since you wouldn't want your changes to appear on the active or live project of the website in case you make a mistake, you'll create a branch (duplicate or copy the website) while the master branch is untouched.

Here's a basic overview of how it works:

Step 1: Create a project (repository) with a git hosting tool like Gitlab.

Step 2: Copy your repository to your local workspace.

Step 3: Add a file to your local repository and save changes.

Step 4: Transfer the changes made to your main branch.

Step 5: Clone and create a branch then make changes to your file with a git hosting tool and save.

Step 6: Propose changes to the branch by opening a pull request.

Step 7: Merge the created branch version to the main branch.

Installing git on other devices

Git is used as a command interface were we can access through the terminal of our PC but it has to be installed first. If you are installing on another device other than windows, click the link to see other options

Installing git on windows

There are variety of option displayed during the installation process but not to worry, the default option will be okay.

Step 1: Download the git installer: From your browser(chrome), go to the official git website to download git for windows.

Step 2: Select the git version suitable for your device then click on download.

N/B: If you aren't sure of the operating byte of your system, type about on the search button and open to find out.

Step 3: After downloading the git extension file, double click on it at the left bottom corner of your computer to start the installation process then click on "Next".

Step 4: Select the location destination to install git on your PC or you can allow it on the default C:/ProgramFiles\git then click on "Next"

Step 5: Select the component of git to be installed. Here, leave it at its default setting and click on "Next".

Step 6: Select the start menu folder. You can leave it at git then click on "Next"

Step 7: Choosing text editor: To select your desired text editor, click the drop down button and change from the default vim editor to visual studio code or sublime editor then click on "Next"

Step 8: Click on"Next" to allow git to decide on the name of the initial branch in the new repository.

Step 9: Click on"Next" to allow git use bundled openSSH it secured shell client program.

Step 10: Click on "Next" to allow git use OpenSSL library for HTTPS connections.

Step 11: Finally, you are set to install Git for windows. Leave the boxes unticked and click on "install"

Step 12: Git is undergoing installation on your system.

Step 13: Click on finish to complete the installation process.

Congratulations! you have finally installed git in your Windows PC.

To confirm installation; Click on the search button and type cmd to open the command prompt then if you see the image below, your Git is successfully installed and ready to be used.

Conclusion

In programming, a lot of people work together on a lot of files to achieve results. Understanding how this Open source version control system (Git) work, will help your journey as a software developer. This article was written to give an overview of what Git is and how to get started with it. The next step is now for you to learn its commands and how to use it effectively either as an individual or group project.

Glossary:

Source code: simply are codes,stored in files inside a folder. For example, if you are building a web application or IOS or android application there's going to be a bunch of files in a bunch of folders.

Repository: A cloud or storage space in which collected data or project is stored and managed. This is the power house of Git because it contains the project. From the example in this article, the common folder is the repository.

GitHub: it's a centralized server or an online hosting system where developers can distribute Git projects or commit for the purpose of working together to obtain efficient work. It is used by a series of individuals (developers, programming instructors), organizations around the globe to create millions of open source project and enable organized collaboration in a single platform. From the example, it is the cloud in which the repository is uploaded.