What is Git and GitHub?

Coccagerman
3 min readAug 12, 2021

--

People tend to confuse them or just use the same name to identify both things but, even if they are used together most of times, git and github are different things actually.

Git

Git is a distributed version control system or DVCS originally developed by Linus Torvalds. Its main functionality is to allow developers to keep track of all the changes implemented on a project and to be able to go back or reverse to a previous version at any time. Through git, projects are stored in repositories, which are data structures that store metadata about the project. Some of the metadata that a repository contains includes, among other things:

  • A historical record of changes in the repository.
  • A set of commit objects. A commit is the action of implementing a change in the project. Thanks to git, each commit can be visualized individually and reversed if needed.

We say git is a distributed VCS because the whole set of information in the repository is duplicated on every user’s system, rather than stored on a single server.

Another important functionality of Git is the chance to split projects in branches. Branches are like a paralel copy of the project’s code. You can generate these “copies” at any time and work on them without affecting the main branch or original code source. This is super useful when you need to develop an important feature or solve a tough bug without affecting the original code base. Once the new feature or bug solution is well tested, the branch can be merged with the original code source. Merging is the process of combining one branch with another, because at the end of a project of course we can only have one unique code base. In the merging process, git will identify if there are any conflicts between the branches. Conflicts are situations in which the different branches have different versions of the same code. In these situations git doesn’t know what version we want to keep, so it will ask us to decide. If git doesn’t detect any conflict, meaning the branches don’t have any overlapping code, it will combine the code automatically.

There’s more to git than this, but these are its main functionalities.

Github

Github is an online platform for repositories storage owned by Microsoft. Its main functionality is to allow users to easily work as a team on a same project. In github users can upload repositories and through an integration with Git, they can also work on branches, visualize commits, merge branches and reverse changes when needed. Again there’s more to github than this, but these are its main functionalities.

Github is heavily used by companies and open source projects thanks to the advantages it provides to teamwork. The usual workflow used for team collaboration on github is the following:

  • A repository is created.
  • Each developer clones the repository, which means creating a local copy of it in their individual computer.
  • New branches are created for each different functionality to be developed. Also different branches are created for different stages of the development process. Usually there’s a development branch in which new code is generated by developers; a testing branch in which code is tested to ensure its quality; and a production branch in which already tested code is shipped.
  • As developers build functionalities, they commit and push the changes to the github repo, and do a pull request. Pull requests are the way in which developers ask their code to be merged with the main code base. Normally each pull request goes through a validation process, entirely customizable by each team, and then gets merged.

And that’s it!

--

--