صورة git

What is Git and why should you use it?

In the simplest terms, as a computer science student at the university, and with a simple semester project that involves creating a website, you can collaborate with three of your classmates as follows:

😶 Maybe we all work on one computer.

🤓 No, each of us will work on our own computer, and we’ll exchange files through WhatsApp.

🤔 What if we make edits to the same file? How will we get updates from everyone?

🙄 Man, this seems complicated.

😀 It’s better if one of us volunteers and completes the project alone.

No need to worry because if you use Git, all your problems will be solved.

What is Git in simple terms?

It’s a distributed version control system, free and open-source, designed to handle everything from small to very large projects quickly and efficiently.

Version Control System (VCS)

Before we delve into the details of Git, we need to understand the concept of Version Control System (VCS). In short, it’s a system that records changes to a file or group of files over time.
With VCS, you can revert files to a previous state or even revert the entire project to a previous state and compare changes over time.

You can also track who from the team made changes to the project, the reason for a specific problem, and when it occurred, down to the date and time.

How Git was Created

The Linux kernel is a widely-used open-source software project. Changes to the software were made in the form of patches and archived files. In 2002, the Linux kernel project started using a specific DVCS called BitKeeper.

In 2005, the relationship between the Linux kernel development community and the commercial company that developed BitKeeper collapsed because BitKeeper became non-free.
This prompted the Linux development community, particularly Linus Torvalds, the creator of Linux, to develop their own tool based on some lessons learned while using BitKeeper. And thus, Git was born.

VCS vs. DVCS: What’s the Difference?

صورة يفكر

It all boils down to the letter “D,” but adding this letter has changed a lot for the better in terms of workflow.

In Distributed Version Control Systems (DVCS) like Git, when a user interacts with the system, they take a complete copy of the repository (or “repo,” a term used to refer to the place where the project is stored).

Here’s where the strength lies: Let’s assume the server hosting the DVCS crashes. In that case, any user can easily copy any repository from the users’ repositories on the server to restore it and continue working safely. Each copy serves as a complete backup of all the data.

Features of Git

1- Branching and Merging

One of Git’s standout features is its branching model. It allows you to have multiple local branches that can be completely independent of each other.

Creating, merging, and deleting these development lines takes just a few seconds.

2- Small Size and Fast Performance

Almost all operations are executed locally, giving Git tremendous speed advantage over centralized systems that need constant communication with the server.

Git was designed to work on the Linux kernel from the start, effectively handling large repositories since day one.
Being written in C reduces runtime overhead associated with higher-level languages.

3- Distributed

Due to Git’s distributed nature and excellent branching system, nearly infinite workflows can be executed relatively easily.

Each user essentially has a complete backup of the main server. If the server fails, any of these copies can be pushed to replace the main server for safe continuation of work.

There is essentially no single point of failure in Git as long as there is not a single copy of the repository.

4- Data Integrity

Git’s data model ensures the integrity of encryption for each part of your project.

5- Staging Area

Unlike other systems, Git has a staging area where commits can be staged and reviewed before committing.

This allows you to quickly organize and execute some of your files without committing all other modified files in the working directory or needing to list them on the command line during commit.

6- Free and Open Source

Git was released under the GNU General Public License version 2.0, an open-source license.

The Git project chose GPLv2 to ensure your freedom to share and change free software to ensure that the program is free for all its users.

In Conclusion

Git stores and thinks about information very differently from other version control systems.

It doesn’t think of the information it saves as a set of files and changes made to each file over time.
Git thinks of data more like a series of snapshots of a miniature filesystem.

Each time you commit your project’s state in Git, it takes a picture of what all your files look like at that moment and stores a reference to that snapshot.
It doesn’t store the file again; just a link to the identical file it has already stored. Git thinks of its data like a stream of snapshots.

Leave a Reply

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