Git

How to Merge When master is Not The Base Branch

If the base branch for your repository is not the default master, you might have encountered this bizarre Pull Request problem when you try to deploy from base branch onto master:

You merged from base branch dev to master with a Pull Request. Then when you want to merge some other change from dev to master, somehow the old changes are still there!

The problems lies in the way we merge. There are 3 options (if you can’t find them in the dropdown, go to Settings -> Options -> Merge button and enable them):

3 options to merge

Due to the nature of squash and rebase, only the first option will actually preserve both the file changes and the exact same git commits, thereby putting dev and master on the same line, in the same status, after a merge.

Therefore, solution:

Use the normal merge, Create a merge commit to merge base branch dev into deploy branch master.

Standard

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.