Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the conflict of two branch, but not need to merge them?

Tags:

git

I can't merge two branch because of release step of our project, but I want to know whether there are conflict of two branch. How can I do this?

like image 402
Jair Avatar asked Jun 04 '12 09:06

Jair


People also ask

How do you know if there are merge conflicts?

To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<< . When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD .


1 Answers

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.

like image 120
Sandro Munda Avatar answered Sep 23 '22 20:09

Sandro Munda