World map

 

BM: Baca dalam Bahasa Melayu

World 11: Rescue Center

Messy pull: abort

You will learn: how to back out of a pull that stopped with conflicts.

The problem

git pull --rebase fetches Aisyah's commit, then stops: CONFLICT (content): Merge conflict in index.html. Could not apply Say Git is fun. Terminal output: $ git pull --rebase From https://github.com/you/diary 270a76e..046fbbc main -> origin/main Auto-merging index.html CONFLICT (content): Merge conflict in index.html error: could not apply c9d5315... Say Git is fun hint: Resolve all conflicts manually, mark them as resolved with hint: "git add/rm <conflicted_files>", then run "git rebase --continue". hint: You can instead skip this commit: run "git rebase --skip". hint: To abort and get back to the state before "git rebase", run "git rebase --abort". hint: Disable this message with "git config set advice.mergeConflict false" Could not apply c9d5315... # Say Git is fun

You pull. CONFLICT! You and Aisyah changed the same line. Too messy right now? This happens to everyone. You can always back out.

Try it

A pull with --rebase stops in the middle of a rebase. git status tells you how to leave.

Tap the line in git status that shows the way back.

~/diary $ git pull --rebase~/diary $ git status

0 of 1 found

Try it

Back out of the messy pull. Your work goes back to just before it.

6d3a9b1a8feb63270a76e046fbbcc9d5315

Check

Which exit fits? git status always tells you.

Drag a card into a box. Or tap the card, then tap the box.

      Predict

      You backed out. What about Aisyah’s commit?

      Pick one answer.

      You did it!

      You can now back out of a messy pull, calmly.

      Go deeper (optional)

      Ready to try again? Pull once more and fix the clash. In a rebase: edit the file, git add it, then git rebase --continue. In a merge: edit, git add, then git commit. Unsure whose line wins? Ask your teammate first.