Search code examples
gitpalantir-foundryfoundry-code-repositories

Squash and merge option resulting in out of date branch. How to avoid this?


In Code Repositories, when I try and squash and merge branches, there seems to "branch out of date" issues, when trying to open a pull request.

Consider the following sequence of merges done via squash and merge: master -> validation -> dev.

Now, once I commit something onto dev, and then try and merge dev into validation, it says that dev is out of date with validation. How to avoid this, or what am I doing wrong here?

I would like to be able to solve this on Code Repositories itself, because I am not sure if Cloning a Python Transforms project locally is a good idea.

I have tried using the full merge option whenever merging one branch onto another, and this seems to work fine. However, this results in the commit history on the branch exploding, so I would like to use squash and merge.

Kind regards.


Solution

  • Code Repositories is backed by git. I assume you branched out of validation into dev, is it possible someone committed something to validation after you branched out? in that case you need to update dev with the contents of validation before pushing. If you have git locally in your laptop you can also checkout the project and do it manually.

    git checkout validation
    git pull origin validation
    
    git checkout dev
    git pull origin dev
    
    git merge validation
    
    # if needed to solve any conflicts
    git mergetool