What is the difference between Git and GitHub?
Show answer — try answering out loud first
Git is the version control tool that runs on your machine. GitHub is a cloud service for hosting Git repositories and collaborating (pull requests, issues, code review). You can use Git without GitHub, but not GitHub without Git.
It's a very common mistake to mix them up because they are almost always used together.
- Git: the program you install and use in the terminal. It handles commits, branches, merges. All version control happens here, locally.
- GitHub: a web platform (owned by a company, Microsoft) where you upload your Git repositories to store them in the cloud, share them, and collaborate. Alternatives: GitLab, Bitbucket.
Analogy: Git is like the ability to write; GitHub is like Google Docs, a place in the cloud where you store and share what you wrote. GitHub adds things that Git doesn't have on its own: pull requests, issues, team permissions, CI/CD, etc.
# Git (local): create a repo and make a commit, without internet
git init
git add .
git commit -m "Primer commit"
# GitHub (remote): connect your local repo to one on GitHub and push it
git remote add origin https://github.com/usuario/mi-repo.git
git push -u origin main
# push sends your local commits to the remote server (GitHub)
Saying "I uploaded my code to Git" when it was actually uploaded to GitHub. Git is not a place you "upload" things to; it's the tool. It's also a mistake to think you need a GitHub account to use Git: you can version projects entirely locally without any account.
"Git is the version control tool that runs on my machine; that's where I make commits, branches, and merges. GitHub is a cloud service for hosting Git repositories and collaborating, with things like pull requests, issues, and code review. I can use Git perfectly fine without GitHub, but GitHub without Git makes no sense. Alternatives to GitHub would be GitLab or Bitbucket."
If you delete your project from GitHub but you have a cloned copy on your computer, do you lose the commit history?
Show answer
No. Since Git is distributed, your local copy (the clone) contains the complete repository, including the entire history. You could create a new remote repository and run git push to upload it again. GitHub is just a copy hosted in the cloud, not the single source of truth.