Search code examples
palantir-foundryfoundry-code-repositories

How do I merge a Pull Request when develop branch out of date?


I am trying to merge my develop branch to the master branch via a pull request. On the pull request page, I am getting the message "Branch is out of date. Merge master into **develop **to remedy."

The problem is that no updates have been made to the master branch since develop branched off of it, other than maybe automated repository upgrades.

I attempted to merge master into develop, but received the same message, just with the branch names swapped.

I understand that to resolve the issue I need to merge master into develop first. However, if I open a PR to go from master to develop, I get the same message as before. There is no mechanism to allow me to merge in those changes.

enter image description here


Solution

  • The most common cause of this is squashing commits from feature-branch -> develop and then again squashing between develop and master. This is fairly easy to fix locally using the git command line. You'll need to have git installed on your machine and then you can follow the following steps:

    • Click Clone in the top right and copy the url given. enter image description here
    • Clone the repo: git clone [COPIED URL]
    • Make sure you're on master: git checkout master
    • Create a new branch: git checkout -b fix_merge_conflicts
    • Merge from develop: git merge develop
    • Git will give you a list of files with conflicts, open these and fix the conflicts by removing appropriate lines.
    • Add the fixed files: git add myfile.txt folder/otherfile.py
    • Commit your changes: git commit
    • If the message looks okay, exit the editor (normally vi, so use :wq to exit).
    • Checkout master again: git checkout master
    • Merge in changes from your branch: git merge fix_merge_conflicts
    • Checkout develop: git checkout develop
    • Merge in changes from your branch: git merge fix_merge_conflicts
    • Push all changes back to your Code Repository: git push