BM: Baca dalam Bahasa Melayu
World 4: Hello GitHub
Forks and syncing
You will learn: how to copy someone's project into your account and keep your copy up to date.
The problem
Mei’s recipe site has a typo. You can’t push to her repo. How can you help?
Pick one answer.
Watch
Tap each point on the timeline.
A fork: Your own copy of someone else's project, in your account. is your own copy of someone’s repo, on GitHub. Tap each step.
Watch
Your clone knows origin: your fork. Add Mei’s repo as a second remote. The usual name for it is upstream: The remote branch your branch follows, like origin/main. For a fork, also the usual name for the original repo..
Predict
Mei adds a roti canai recipe to her repo. Does your fork get it by itself?
Pick one answer.
Try it
Sync your fork: add upstream, fetch, merge, then push.
Hint
Four commands: remote add, fetch, merge, push.Check
GitHub also gives your fork a Sync fork button. On your laptop, it’s these steps. Put them in order.
First step at the top. Put these in order. Use the arrows, or drag.
- git push
- git remote add upstream <Mei’s address>
- git fetch upstream
- git merge upstream/main
Check
Fork habits: good, or needs work? Swipe each one.
Swipe right for good, left for needs work. Or use the buttons.
Sync your fork before you start new work
You did it!
You can now fork a project and keep your copy in sync.
Go deeper (optional)
The GitHub CLI can do this too. gh repo fork --clone forks and clones in one go. gh repo sync updates a fork from its parent. A fork remembers the original, so pull requests know where to go.
Bahasa Melayu
Laman resipi Mei ada salah ejaan. Anda tak boleh push ke repo dia. Macam mana nak bantu?
Fork (salinan sendiri) ialah salinan repo orang lain, milik anda, di GitHub. Tekan setiap langkah.
Clone anda kenal origin: fork anda. Tambah repo Mei sebagai remote kedua. Nama biasanya ialah upstream.
Mei tambah resipi roti canai dalam repo dia. Adakah fork anda dapat dengan sendirinya?
Selaraskan fork anda: tambah upstream, fetch, merge, kemudian push ke fork anda.
GitHub juga beri fork anda butang Sync fork. Dalam laptop, ini langkahnya. Susun mengikut urutan.
Tabiat fork: baik, atau perlu dibaiki? Leret setiap satu.
Kini anda boleh fork projek dan pastikan salinan anda selaras.
You finished this before. Practice is always welcome!
Official docs: Fork a repository · Syncing a fork · git remote
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?