Git check if merge will be fast forward

Merge request fast forward

What if you want to check if merge request will be fast forward to avoid merge confilicts? There is simple solution.

1. Checkout to the target branch

2. Type following command (replace source-branch by yours):

You will get all your changes from source branch in the target branch but without merge commit. So you can check if any conflicts occur or not with the meld tool.

Additions: if merge conflicts are found and you want to prepare your source branch to merge into target branch without conflicts then make these steps:
1. Abort merge request

2. Checkout to the source branch

3. Merge target branch to the source branch

4. Solve merge conflicts and commit changes
5. Checkout to the target branch and check that your merge request now will be without any conflicts

Upd: added --no-ff  flag in the 3rd step in additions.

Leave a Reply

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