Kodeclik Logo

Our Programs

Learn More

Schedule

Kodeclik Blog

Git vs github vs gitlab

You probably heard these terms often and seen them used in similar and related contexts. But you are not quite sure what they mean. We are talking about git vs github vs gitlab!

Git versus github versus gitlab

What is git?

Git is an open-source version control system that allows developers to track changes in their code over time. A version control system allows you to keep track of all versions of all files created, their lineage, allowing you to “go back” to a previous version in case something goes wrong.

Usually when you work with git, there is a local repository and a remote repository containing exactly the same set of code. The local repository is typically on your local computer or laptop. The remote repository is typically on a website - and this website can be github.com or gitlab.com or any number of other options available.

Assume Alice is working on a git project. She creates an empty git project on her local laptop and slowly creates new files. Once she is ready to take a snapshot of the current state of his project, she “commits” the project. This saves state to her local repository. Then she “pushes” the project. This copies the state to the remote repository.

Now let us suppose Alice invites Bob to join her in this project. She gives Bob access to the remote repository. He can “clone” that repository onto his local computer and immediately he gets a local copy of what Alice has been working on. In turn, from this point, he can make changes, commit them (to his local version) and push them (which now makes them available to Alice). Alice at this point can “pull” from the repo and now her version should be in sync with Bob’s version. (This is assuming she hasn’t made edits to the same files - in which case she has to use one of git’s conflict resolution methods).

What is github?

Github is a website that provides cloud-based storage for git repositories. Essentially, github is hosting the remote repository. You can either create the remote repository first on github and then clone it to your local computer, or you can create the local repository first on your local computer and then push it to the github remote repo.

The advantage of github is that it provides many collaboration tools on top of git and features a large community of developers who work on open-source projects. Thus there are numerous public repositories you can explore, clone, and extend for your own purposes!

What is gitlab?

Like github, gitlab is another website that provides cloud-based storage for git repositories. You only need one of github or gitlab - not both for your project.

It might interest you to know that github is owned by Microsoft. Gitlab is operated by an independent company.

You might find it interesting that development for Kodeclik happens using git on gitlab.com!

To understand a full git workflow, below is an example of a sequence of common operations people perform with git repositories.

Cloning a git repo

Developers start by cloning the remote repository to their local machines, creating a local copy of the entire project history.

Making changes to a git repo

Each developer works on their local copy, making changes and additions to the code.

Committing your changes

When a developer completes a set of changes, they commit these changes to their local repository. A commit is like a snapshot of the project at that point in time. Note that commit simply saves the snapshot in the local repository.

Pushing changes to the remote repo

After committing, the developer pushes their changes to the remote repository. This uploads their local commits to the central repository, making them available to other team members.

Pulling changes

Before starting new work, developers typically pull the latest changes from the remote repository to ensure they're working with the most up-to-date version of the project.

Merging edits/changes

If two developers have made changes to the same part of the code, they may need to merge their changes, resolving any conflicts that arise.

Summary

To recap, Git is the underlying version control system, i.e., the underlying technology, while GitHub and GitLab are platforms built on top of Git that provide additional features for collaboration, project management, and DevOps workflows. The choice between them often depends on specific project needs, team preferences, and desired workflow integrations.

To learn more computing concepts, checkout our blogpost on proxy servers and firewalls.

Kodeclik sidebar newsletter

Join our mailing list

Subscribe to get updates about our classes, camps, coupons, and more.

About

Kodeclik is an online coding academy for kids and teens to learn real world programming. Kids are introduced to coding in a fun and exciting way and are challeged to higher levels with engaging, high quality content.

Copyright @ Kodeclik 2024. All rights reserved.