Git vs. GitHub, finally clear
| Git | GitHub |
|---|---|
| A tool installed on your computer | A website/service that stores Git repositories online |
| Tracks history locally | Hosts a backup copy, accessible from anywhere |
| Works with no internet | Requires internet to push/pull |
You could use Git without ever touching GitHub. But GitHub is what lets you back up your work, share it, and โ as you've seen throughout this site โ publish an actual live website for free.
Connecting a local project to GitHub
After that first push with -u, future pushes are just git push โ Git remembers where "origin" points.
The everyday push/pull cycle
git pull before you start working each time. It prevents the frustrating situation of editing an outdated version of a file.
Cloning: getting a copy of an existing project
git clone downloads a full copy of a repository, including its entire history, onto your computer โ this is how you'd start contributing to any existing project on GitHub, including open-source ones.
README files: the front door of your project
Every GitHub repository shows a file named README.md automatically on its main page, if one exists. It's the first thing anyone sees โ a short description of what the project is, how to run it, and anything else a visitor needs to know before digging into the code.
Forks and pull requests, briefly
- Fork โ your own copy of someone else's repository, under your account
- Pull request โ a request asking the original project to merge in changes you made on your fork
This is exactly how open-source collaboration works at scale: you never edit someone else's repository directly โ you fork it, make changes, and propose them via a pull request for the owner to review.
Try it yourself
git remote add origin and push your first commit.
Level up: write a real README
README.md file to one of your projects with at least: a one-sentence description, and a short "how to run this" section. Push it, then visit your repository on GitHub and confirm it renders automatically on the main page.
1. What's the main difference between Git and GitHub?
2. What does git pull do?
3. What is a "fork"?
git push sends commits up, git pull brings new ones down, and git clone gets you a full copy of any repository to start working with.