BM: Baca dalam Bahasa Melayu
World 4: Hello GitHub
Pull with merge or rebase
You will learn: what to do when you and GitHub both have new commits.
The problem
You made titles teal. Aisyah pushed her day. Both of you have a new commit. Tap Pull. What does Git say?
- 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
git pull --no-rebase joins the two with a merge commit. History keeps both paths, like the letter Y.
Predict
Which pull gives one straight line of history?
Pick one answer.
Watch
git pull --rebase lifts your commit and puts it on top of Aisyah’s. One straight line. Your commit gets a new hash, because it has a new parent.
Try it
Tired of choosing every time? Build the command that makes rebase your usual way.
Tap the pieces in the right order.
Hint
A setting, for all projects, named pull.rebase, set to true.Try it
Pull Aisyah’s commit your way. Then push both commits.
Hint
Plaingit pull asks you to choose. Add --rebase or --no-rebase.Check
Good habit, or needs work? Swipe each one.
Swipe right for good, left for needs work. Or use the buttons.
Rebase your own commits that you have not pushed yet
You did it!
You can now pull with merge or rebase, and pick your way.
Go deeper (optional)
git config --global pull.ff only makes pull refuse anything but a fast-forward. A rebase can stop on a conflict, like a merge. Fix the file, git add it, then git rebase --continue. Or run git rebase --abort to go back.
Bahasa Melayu
Anda tukar tajuk jadi teal. Aisyah push harinya. Kedua-dua ada commit baru. Tekan Pull. Apa Git kata?
git pull --no-rebase cantum kedua-duanya dengan merge commit. Sejarah simpan kedua-dua laluan, macam huruf Y.
Pull mana yang beri sejarah satu garis lurus?
git pull --rebase angkat commit anda dan letak di atas commit Aisyah. Satu garis lurus. Commit anda dapat hash baru, sebab induknya baru.
Penat pilih setiap kali? Bina arahan yang jadikan rebase cara biasa anda.
Pull commit Aisyah dengan cara anda. Kemudian push kedua-dua commit.
git pull biasa minta anda pilih. Tambah --rebase atau --no-rebase.Tabiat baik, atau perlu dibaiki? Leret setiap satu.
Kini anda boleh pull dengan merge atau rebase, dan pilih cara anda.
You finished this before. Practice is always welcome!
Official docs: git pull · git config
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?