Skip to content

Update Your Local Repo

Now that you are happy with your change, it is time to integrate them back to the main branch. Up to now, we have not worried about parallel work and potential conflicts. These can be in the form of a merge conflict or new code considerations (eg tests failing, duplicated effort, poor integration).

Pull in changes from the target branch of the remote repository

Before pushing our changes up, we want to make sure they work with the latest version of the application, which is the primary branch of the remote repository. Therefore, it is best practice to perform a pull into our local branch and then specify the target location, which is the main branch of the origin repository. Then the Git command git pull <repo> <branch> results in the following:

git pull origin main

Did you get a merge conflict? 🤔

Depending on the timing of the lab, you may or may not encounter a merge conflict at this point. Of course, the first person to complete their changes and merge into main will not see a merge conflict during this exercise. Similarly, if none of the PRs have been merged in yet, then there would be no conflicts here, but would instead arise later in the exercise.

Merge conflict notification
Git notification of merge conflict

If performing git pull origin main results in a merge conflict like the above screenshot, continue to the next step to resolve them locally. Otherwise, continue to push your changes and submit a PR.