A brief introduction to Git

Alef Aparecido de Paula Bispo
4 min readJun 23, 2023

What is it?

Git is a version control system for projects. Git was created by the skilled hands of Linus Torvalds, also known for being the father of the Linux system. Its need arose when Linus was still working on creating the Linux kernel project, a proprietary tool called BitKeeper was used, but in 2005 the relationship between the Linux development team and the company that made BitKeeper famous collapsed, so the tool passed to be paid, since they urgently needed a similar tool, Linus then created his own, based on the one used previously.

This is our dear Linus
This is our dear Linus

💡A little curiosity: In one of his interviews Linus said that he doesn’t like to be distracted while working, so in the room where he develops there’s just a table with a computer and walls painted green, nothing else.

What does it solve?

Ok, now we know what it is, and who created it, but what does it actually solve?

Git is widely used around the world in different projects, most Big Techs like Google, Meta, Amazon, among others, must make use of this tool to manage project versions. Just imagine how complicated it must be to manage a huge project without a tool like Git.

💡Personal curiosity, in my first internship the people who developed codes for hardware did not know Git, so they did the “versioning” through a Word document, it may seem like a lie, but believe me, this is still done in many companies out there.

Git x Github

People tend to create confusion when they hear both words, some believe they are the same thing, but they are not.

Git, as already explained, is the tool that controls the versions of a project, while GitHub works as a social network for programmers. GitHub is a code management platform, and creates an environment for collaboration between developers, hence the comparison with a social network for devs, it uses Git as a control system.

There are alternatives to Github, such as Microsoft’s Azure, among other similar platforms where project repositories are available so that developers can store the codes.

In the figure below we see the official mascot of GitHub, the famous Mona:

The Mona Mascot
The Mona Mascot

💡 Another curiosity: We Brazilians are the third largest developer community outside the US.

I’ll leave my GitHub profile here as a reference, where I created a Readme that can be used as a base, there are also some personal projects of mine, some more interesting than others.

Link → https://github.com/Tuturado

Another important reminder is that many companies, before hiring professional developers, usually look at their profiles on GitHub, and sometimes look at their projects, so it is very important that it is always updated.

Basic Elements

The intention of this session was to clarify some of the terms that are concurrently used by developers on a daily basis when dealing with the versioning of a project, I will leave below three very important terms, I know that there are several others, but so that things do not get confused, these enough at the start.

Repositories: A repository contains all files in the project and each file’s revision history.

Commits: It is a set of permanent temporary changes, marking the end of a transaction, he who is responsible for persisting the information locally on our machine.

Branches: We can define a branch as a separate copy of the source code, it allows different developers to work on the same project without disturbing each other.

Basic Commands

After we have created a project on our computer we will need to start Git on our project, below is a list of useful commands and what each one of them does:

"git init" -> This is the command we use to start Git in our project

"git clone" -> Generates a copy of a repository on your local machine

"git status" -> Show status

"git log" -> Shows the logs, last commits, time, who did it in the respective branch

"git merge" -> Merge branches

"git checkout" -> Allows you to exit a branch to another

"git checkout -b" -> Create and change to the created branch

"git branch" -> This is the command we use to find out which branch we are working on at the moment

"git add ." -> With this command we will be adding all the modified files of the project to be committed.

"git commit -m "Desired commit message" " -> With this command we will persist our changes locally on our machine

"git push "Branch name" " -> With this command we will upload everything that was in the commit to GitHub, or another similar serviceReferencial

These are some of the commands that are most used in a developer’s day to day.

Conclusion

The intention of this content was to clarify for people who had never had contact with this tool, its main points, the differences between Git and GitHub is also of fundamental importance.

All developers at some point will need to use these tools to be able to manage their projects, especially when there are other developers who will contribute.

This is a theoretical post, built based on the commands that I use on a daily basis as a developer, if there is a need to create visual content, please comment so that I can produce it.

--

--

Alef Aparecido de Paula Bispo

I am Alef, graduating in Computer Science, passionate about technologies, reading and games. Connect to me: https://www.linkedin.com/in/alef-paula-aa98041ba/