How to check merge conflicts of two branches, without merging them?

git

Solution

Suppose you are on the `master` branch and you would like to test if the `dev` branch can be merged without conflict into the `master`.

# In the master branch
git merge dev --no-ff --no-commit

After that, you will be able to know if there's a conflict or not.

To return in a normal situation, just abort the merge:

`git merge --abort`

According to the git documentation:

`--ff` Do not generate a merge commit if the merge resolved as a fast-forward, only update the branch pointer. This is the default behavior.

`-no-ff` Generate a merge commit even if the merge resolved as a fast-forward.

`--commit` Perform the merge and commit the result. This option can be used to override --no-commit.

`--no-commit` With --no-commit perform the merge but pretend the merge failed and do not autocommit, to give the user a chance to inspect and further tweak the merge result before committing.

Problem

I can't merge two branches because of a release step of our project, but I want to know whether there are merge conflicts between them. How can I do this?

Original source

Related problems