Git Rebase Errors

ENV 872 - EDA   |   Spring 2024   |   Instructors: Luana LimaJohn Fay  |  

Divergent branches

At some point, when issuing the command git pull upstream main you may get a response like this:

Git rebase error

What happened?

You’ve encountered a divergent branch in your repository. :face_with_head_bandage:

These occur when two sources (e.g. the upstream remote and your local repo) have both been updated independently and have commits that are not present in the other branch. This means that the repositories have diverged and have different histories.

What to do?

  • At the RStudio terminal, type the command git config pull.rebase false
  • Then, try the upstream pull again git pull upstream main
  • You may be bumped into Git’s text editor which looks like a bunch of lines starting with ~. To exit this, hit <shift>-Z a bunch of times.
  • Run git status to see that everything looks good. If not, feel free to contact an instructor or TA.