💻Git, GitHub, and GitLab:: What’s the difference?
If you’re writing code, you need a way to keep track of changes. That’s what Git does. It lets you save different versions of your project so you can go back if something breaks. It also lets multiple people work on the same code without stepping on each other’s toes.
Git is not the same as GitHub. Git is the system that manages versions of your code. GitHub is a website that makes Git easier to use and adds features like collaboration tools. GitHub is to Git what Google Docs is to a Word file on your computer.
GitHub isn’t the only site that hosts Git repositories. There’s also GitLab and Bitbucket. But GitHub is the biggest, so when people talk about Git, they often mean Git and GitHub together.
Why Git Matters
Before Git, teams had a hard time working on the same code. One developer would make changes, send an email with an updated file, and hope no one else had changed the same thing. Sometimes they had, and someone had to merge the changes manually. If you wanted to go back to an old version, you had to rename files like project-final-v3-FINAL-FINAL-revised.zip.
Git fixes this. It keeps track of every change. You can work on your own copy of the project, make edits, and then merge them back in. If two people change the same file, Git tells you there’s a conflict so you can fix it before anything breaks.
How It Works
Git is based on a simple idea: snapshots. Every time you save your code, Git takes a snapshot of all your files. If something goes wrong, you can jump back to an earlier snapshot.
These snapshots live in a repository — a folder where Git keeps track of everything. The repository can be on your computer or hosted on a site like GitHub.
Branching and Merging
One of Git’s best features is branching. Instead of editing the main code directly, you create a branch — a separate copy where you can experiment without breaking the original. If your changes work, you merge them back into the main branch. If they don’t, you delete the branch and move on.
This is called trunk-based development. The main branch is like the trunk of a tree. Developers create branches, make changes, and then merge them back in.
An Example
Say you’re building a music app with a team. You create a branch to add a feature that highlights Bluegrass music. While you’re working, your teammate Greg, who prefers Rock, creates his own branch to modify the homepage.
Greg finishes first and merges his changes into the main branch. When you try to merge yours, Git tells you there’s a merge conflict. Both of you changed the same file.
To fix it, you review both changes and decide how to combine them. In the end, the homepage features both Bluegrass and Rock. You commit the final version, and now the app is better than before.
The Big Picture
Git isn’t just about storing code. It’s about enabling collaboration. A team of developers can work on the same project without overwriting each other’s work. They can track every change, revert mistakes, and build new features safely.
This is why Git is the standard for modern software development. Whether you’re a solo developer or working on a huge project with thousands of contributors, Git is how you keep things under control.
If you’re not using it yet, you should be.
Further Reading::
🤖ChatGPT for Vulnerability Detection by Tahir Balarabe
Get Tahir’s stories in your inbox
Join Medium for free to get updates from this writer.
Stable Diffusion Deepfakes: Creation and Detection
The Difference Between AI Assistants and AI Agents (And Why It Matters)
🚀DeepSeek R1 Explained: Chain of Thought, Reinforcement Learning, and Model Distillation
đź’ˇPrompt Tuning: A New Approach to Large Language Model Specialization
đź’ˇRetrieval-Augmented Generation(RAG) for Accurate LLMs
Git vs GitHub – Key Differences
| Feature | Git | GitHub |
|---------------|----------------------------|------------------------------|
| **Definition** | A version control system | A hosting service for Git |
| **Usage** | Tracks and manages changes locally | Stores Git repositories online |
| **Installation** | Installed on local machines | Cloud-based, accessible via browser |
| **Collaboration** | Requires manual merging | Provides tools like pull requests |
| **Cost** | Free and open-source | Free for public repos, paid for private repos |
---
### **Basic Git Commands**
```bash
# Initialize a new Git repository
git init
# Clone a remote repository
git clone <repository-url>
# Check status of changes
git status
# Stage all changes
git add .
# Commit changes with a message
git commit -m "Your commit message"
# Push changes to a remote repository
git push origin main
# Pull latest changes from a remote repository
git pull origin mainFrequently Asked Questions about Git, GitHub, and GitLab
What is Git, and what is its primary function?
Git is a version control system. This means it tracks all modifications made to code, allowing developers to revert to previous versions, manage changes, and collaborate on projects more effectively. It essentially serves as the foundation for managing code and its history.
What are GitHub and GitLab, and how do they differ from Git?
GitHub and GitLab are hosted Git platforms. Unlike Git, which runs on a local machine, they exist in the cloud or on the web. These platforms provide a central location for managing Git repositories, adding features for collaboration and project management. They are also popular for hosting open-source projects and fostering diverse developer communities. Essentially, Git is the engine, and GitHub/GitLab are the platforms that provide a convenient interface and collaborative tools for using Git.
How does Git help in tracking changes made to code?
Git allows you to track every single modification made to your code. It functions like a series of snapshots, enabling you to see what changes were made, when, and by whom. This provides an excellent history of your code base and enables you to easily revert to previous states if needed. This also means that when teams are working together, each team member’s contributions are tracked separately and can be referred back to as needed.
Why is Git important for team-based development?
Git facilitates team-based development by allowing multiple developers to work on the same project simultaneously without overwriting each other’s changes. Developers create their own branches to work on features and then merge their changes back into the main branch. Git’s merging and conflict-resolution capabilities ensure that multiple contributions can be integrated effectively and reliably. This allows many developers to work on the same project concurrently while reducing errors and keeping workflows organized.
Can you explain the concept of “Trunk-Based Development” in relation to Git?
Trunk-based development is a branching strategy where the “trunk” represents the main or primary branch of a project’s code. Developers create branches off this trunk to work on new features or bug fixes, then merge the changes back into the trunk when they’re completed. It provides a streamlined workflow that keeps the main branch as a deployable version, integrating changes often. It enables a team to work together while making it easier to find the most recent and correct version of the code.
What is a “repository” in Git, and how is it used?
A repository (repo) is a storage location for your code and its entire history. It houses all project files, metadata, and Git’s version control information. A repository can be hosted in the cloud using platforms like GitHub or GitLab, or it can be stored locally. When collaborating, developers will typically clone, or download a copy of the repository to their local machines. Changes can be worked on and then pushed back to the central repository.
What is a “merge conflict” in Git and how is it resolved?
A merge conflict occurs when two or more developers have modified the same part of a file in their separate branches, and Git cannot automatically reconcile the changes. To resolve a merge conflict, a developer must manually review the conflicted sections of the code, decide which changes to keep, and then submit a new commit with the corrected changes. This is usually done using Git’s command line or by using a GUI provided by the platform such as GitHub or GitLab.
What is a “pull request” (PR), and what is its role in the Git workflow?
A pull request (PR) is a request made by a developer to merge their changes from a branch into another branch, usually the main branch. A PR allows other team members to review the proposed changes, provide feedback, and ensure that the changes do not introduce new issues. It fosters better collaboration and helps maintain code quality by creating opportunities for feedback and preventing errors before changes are merged into the main branch.








