๐Ÿ”’ Members-only lesson โ€” thanks for supporting devnotes
← back to course
progress is saved in this browser โ€” no account needed
devnotes / Developer Tools / Lesson 3
lesson 3 of 6 ยท premium

GitHub: Sharing and Backing Up Your Code

18 min ยท Developer Tools

Git (Lesson 2) tracks your history locally, on your computer only. GitHub takes that history and puts a copy online โ€” safe if your laptop dies, visible to collaborators, and it's literally how this entire devnotes site is hosted and published.

Git vs. GitHub, finally clear

GitGitHub
A tool installed on your computerA website/service that stores Git repositories online
Tracks history locallyHosts a backup copy, accessible from anywhere
Works with no internetRequires 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

$ git remote add origin https://github.com/username/repo-name.git # "origin" is just the conventional nickname for your GitHub copy $ git push -u origin main # uploads your commits to GitHub for the first time

After that first push with -u, future pushes are just git push โ€” Git remembers where "origin" points.

The everyday push/pull cycle

$ git add . $ git commit -m "Fix nav bar spacing" $ git push # sends your local commits up to GitHub $ git pull # downloads any new commits from GitHub you don't have yet
quick tip
If you work across two computers, or with anyone else, run git pull before you start working each time. It prevents the frustrating situation of editing an outdated version of a file.
AD SLOT โ€” 728ร—90 or responsive (mid-lesson)

Cloning: getting a copy of an existing project

$ git clone https://github.com/username/repo-name.git

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

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

exercise
If you haven't already (you likely have, from publishing this very site), create a new empty repository on GitHub, then connect a local project to it with git remote add origin and push your first commit.

Level up: write a real README

exercise 2
Add a 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.
โœ“ quick check โ€” 3 questions

1. What's the main difference between Git and GitHub?

2. What does git pull do?

3. What is a "fork"?

what's next
Lesson 4 covers VS Code โ€” the shortcuts and extensions that separate someone who's comfortable in their editor from someone fighting it all day.
bottom line
GitHub hosts your Git history online โ€” 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.
AD SLOT โ€” 300ร—250 or responsive (in-lesson)
next upLesson 4: VS Code Like a Pro
Continue โ†’