Git & GitHub · Lesson 56 of 144
Pushing to GitHub
Git push.
Pushing means uploading your commits to the remote. After a push, GitHub has the same history as your computer.

- Push = upload commits
- GitHub gets your history
- Both sides match
The first push
The first time, we type git push, dash u, origin, main. That means push the main branch to origin. Git says new branch, main to main. Dash u links your local main to the one on GitHub, so next time, plain git push is enough. Status now even says we're up to date with origin main.
git
git push -u origin main To https://github.com/sam/my-site.git * [new branch] main -> main branch 'main' set up to track 'origin/main'. git status On branch main Your branch is up to date with 'origin/main'. nothing to commit, working tree clean
Every push after that
Now the everyday rhythm. Make a change, and commit it. Then just git push. Git sends only the new commit. The arrow shows main moving from the old hash to the new one, on GitHub.
git
echo '<p>Thanks for visiting!</p>' >> index.html git commit -am "Add thank-you line" [main 9e5d751] Add thank-you line 1 file changed, 1 insertion(+) git push To https://github.com/sam/my-site.git f63a17a..9e5d751 main -> main
Summary
The first push is git push dash u origin main. After that, just git push. Next, how GitHub knows it's really you.
Key takeaways- git push -u origin main
- Then just git push
- Only new commits are sent
Next up: Proving It Is You — tokens and SSH keys