BM: Baca dalam Bahasa Melayu
World 4: Hello GitHub
Your first push
You will learn: how to send your commits to GitHub with git push.
The problem
Your diary has 3 commits. Your GitHub repo is empty. What carries the commits up there?
Pick one answer.
Watch
A courier carries three commits from your laptop to the empty GitHub repo. Now GitHub's main matches yours, and your laptop shows origin/main.
- ea2c020Add purple style (only on your laptop)main (HEAD is here)
- f6c78e5Add home page (only on your laptop)
- 2efd0f2Add README (only on your laptop)
A push: Send your new commits to a remote, like GitHub. is a courier. It carries your new commits up to GitHub. git push -u origin main sends main to origin.
Watch
-u sets the upstream: The remote branch your branch follows, like origin/main. For a fork, also the usual name for the original repo.: main now follows origin/main. From now on, plain git push knows where to go.
Try it
Your turn. Tap a command and watch the courier.
- ea2c020Add purple style (only on your laptop)main (HEAD is here)
- f6c78e5Add home page (only on your laptop)
- 2efd0f2Add README (only on your laptop)
Tap an action. Watch the courier.
Hint
Try the short one first. Read what Git says.Predict
Nothing is new. You run git push again. What does Git say?
Pick one answer.
Try it
You added an about page. Send it with the short command.
Hint
The upstream is set, sogit push is enough.You did it!
You can now push your commits to GitHub.
Go deeper (optional)
git config --global push.autoSetupRemote true makes plain git push set the upstream for new branches too. git push origin --delete old-branch deletes a branch on GitHub. Pushing a new branch makes GitHub print a pull request link.
Bahasa Melayu
Diari anda ada 3 commit. Repo GitHub anda kosong. Apa yang bawa commit itu ke sana?
Push (hantar) ialah kurier. Ia bawa commit baru anda naik ke GitHub. git push -u origin main hantar main ke origin.
-u tetapkan upstream: main kini ikut origin/main. Lepas ini, git push sahaja dah tahu ke mana.
Giliran anda. Tekan satu arahan dan tengok kurier itu.
Tiada yang baru. Anda jalankan git push lagi. Apa Git kata?
Anda tambah halaman about. Hantar dengan arahan pendek.
git push dah cukup.Kini anda boleh push commit anda ke GitHub.
You finished this before. Practice is always welcome!
Official docs: git push · Pushing commits to a remote repository
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?