Git, GitHub and GitLab. Are they all the same thing?
Tags: commandline, howto, git
Published: 2020-09-02 12:23:36

---
title: Git, GitHub and GitLab. Are they all the same thing?
published: true
date: 2020-09-02 12:15:00 UTC
tags: commandline,howto,git
canonical_url: https://flaviabastos.ca/2020/09/02/git-github-and-gitlab-are-they-all-the-same-thing/
---

A few years back when I got serious about learning to program to become a software developer, I remember hearing about version control and getting really confused about git and GitHub (one can add GitLab to this list also!). Are they the same thing? Eventually I figured it out but this past week in a conversation with a coworker, who is interested in getting into software development, I noticed that they also were confused about this so I decided to write about it.

### Version control

Version control systems do exactly what their name says: they control versions of your software. If you are just starting and all you build is simple programs with dozens of lines, using a version control sounds a bit overkill and unnecessary. And it might be!

Now, let’s say you build a web page: it has some html and css. You spend some time tweaking the colors, fonts, font size and finally get to a point where you are ok with the result. This is saved locally and only you can see it. Next day you take another look and decide you want to try a different colour palette, font face, etc. You make all those changes and now you lost yesterday’s version. To keep the two versions you might want to save a copy of the file and name it like “`my_webpage_version1.html`” before you start making the changes, for example. But this approach is only practical on very small projects. Imagine if your changes affect multiple files or even worse, you decided to try yet another version with a third combination of colours, fonts, etc. It’s impractical to manually keep track of all these versions. This is why using a version control system can be really helpful.

### Git

[Git](https://git-scm.com/) is currently the most popular version control system. It’s a system that you download and install on your computer and interact with it via command line. Git has its own set of commands and it may take some time until you get comfortable with them but for the very basic functionality you only need a handful of commands (I [wrote here about the commands I use most often](https://dev.to/flaviabastos/git-most-used-git-commands-4poo) – there aren’t really many of them!). And now with git, you create a commit for that first version of the web page. Creating a commit is like adding a bookmark or taking a snapshot of the file as it is at that moment. Then you can continue and make more changes, take another “snapshot” (make another commit) and so on. When you want to get back to the first version, you just to go back to that first commit, but your other commits are all safely saved.

I know this all sounds like almost the same thing as saving file versions before making changes but trust me, this is way more efficient. There’s a leap of faith required here. Trust me on this. ![😉](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f609.png)

Now, let’s say you want to share your webpage with your friend Hermione and get her opinion on which version she likes best. Remember, this web page is only some local files on your computer. The different versions are all saved locally, in what in “git speech” we call a repository (think of it as a folder – it’s a bit more complex than this but for now thinking of it as a folder is ok). Should you email her these multiple files? What if you have images also? Share the whole repository via a service like Google Drive?

What if you could send this bundle to some location where Hermione can access it and using git, also toggle between the multiple different versions (commits)?

Hmmmm…. ![🤔](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f914.png)

### GitHub and GitLab

[GitHub](https://github.com/) and [GitLab](https://about.gitlab.com/) are online services that keep a remote version of your repository so the files can be easily accessed by other people. I think the confusion comes from these services also being called “git something” and the fact that they operate with git commands as well. Think of them as “a place to share your programs.”

GitHub is very popular among open source users and I would say the most popular of the two but they both have the same general purpose.

So now, you create an account on GitHub or GitLab and upload your repository there using git commands. From now on this is the “remote” version of your files/repository. You tell Hermione what’s your repository’s url and she can, using git, download it (or in “git speech”, clone it) on her computer and check out all the different versions and give you some feedback.

**To sum up:**

This whole process uses `git` as a system to keep track of the various commits and to manage the local and remote versions of your repository. GitHub and GitLab are the hosts of the remote version.

I hope this helps to clarify the difference between git, GitHub and GitLab. ![🤓](https://s0.wp.com/wp-content/mu-plugins/wpcom-smileys/twemoji/2/72x72/1f913.png)

Some notes:

- GitHub also has an interactive user interface but I never used it so I can’t speak about it. Using the command line is the most common way to use git.
- this [article helps you get started with git and GitHub](https://docs.github.com/en/github/getting-started-with-github/set-up-git)

* * *

> If you found this helpful, let me know on [Twitter](https://twitter.com/FlaSustenido)!

> _The post _[Git, GitHub and GitLab. Are they all the same thing?](https://wp.me/pa0b0y-6N)_ was originally published at _[flaviabastos.ca](https://flaviabastos.ca/)