BM: Baca dalam Bahasa Melayu
World 4: Hello GitHub
Push rejected? Fix it
You will learn: why GitHub sometimes refuses your push, and the calm fix.
The problem
Your teal titles are ready. Tap Push. Watch what comes back.
- c1240a3Make titles teal (only on your laptop)main (HEAD is here)
- ea2c020Add purple styleorigin/main
- f6c78e5Add home page
- 2efd0f2Add README
- c64aa8eAdd Aisyah's day 2 · Aisyah (only on GitHub)main
- ea2c020Add purple style
- f6c78e5Add home page
- 2efd0f2Add README
Tap an action. Watch the courier.
Watch
GitHub has Aisyah’s new commit. Yours doesn’t build on it. So GitHub says no, to keep her work safe. Tap the line that refuses, and the line with the fix.
Tap the refusal and the fix.
0 of 2 found
Try it
Fix it with the courier. Bring Aisyah’s commit down, then push again.
- c1240a3Make titles teal (only on your laptop)main (HEAD is here)
- ea2c020Add purple styleorigin/main
- f6c78e5Add home page
- 2efd0f2Add README
- c64aa8eAdd Aisyah's day 2 · Aisyah (only on GitHub)main
- ea2c020Add purple style
- f6c78e5Add home page
- 2efd0f2Add README
Tap an action. Watch the courier.
Hint
Pull first. Push second.Predict
A friend says, “Just add --force!” What happens to Aisyah’s commit on GitHub?
Pick one answer.
Check
Push rejected? Put the calm fix in order.
First step at the top. Put these in order. Use the arrows, or drag.
- Push, and it gets rejected
- Fix conflicts, if Git asks
- Pull to bring in the new commits
- Push again
Try it
Now in the terminal. Push, read Git’s words, fix it, push again.
Hint
git pull alone asks you to choose: add --rebase or --no-rebase.You did it!
You can now fix a rejected push without losing anyone’s work.
Go deeper (optional)
Fetched already, but not pulled? Then Git says “non-fast-forward” instead of “fetch first”. Same fix: pull, then push. A push can also be refused by branch rules on GitHub. That is World 5.
Bahasa Melayu
Tajuk teal anda dah siap. Tekan Push. Tengok apa yang kembali.
GitHub ada commit baru Aisyah. Commit anda tak dibina di atasnya. Jadi GitHub tolak, untuk jaga kerja Aisyah. Tekan baris penolakan, dan baris cara membaikinya.
Baiki dengan kurier. Bawa turun commit Aisyah, kemudian push semula.
Kawan kata, “Tambah je --force!” Apa jadi pada commit Aisyah di GitHub?
Push ditolak? Susun cara tenang membaikinya.
Sekarang dalam terminal. Push, baca kata-kata Git, baiki, push semula.
git pull sahaja minta anda pilih: tambah --rebase atau --no-rebase.Kini anda boleh baiki push yang ditolak tanpa sesiapa kehilangan kerja.
You finished this before. Practice is always welcome!
Official docs: git push · Dealing with non-fast-forward errors
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?