dole doug dole doug - 1 year ago 63
Git Question

How to test a merge without actually merging first

Is there any way of simulating a

git merge
between two branches, the current working branch and the master, but without making any changes?

I often have conflicts when I have to make a
git merge
. Is there any way of simulating the merge first?

Answer Source

I don't think there is a way of simulating what will happen until you try the merge. However, if you make sure that the output of git status is empty before you do the merge, it is quite safe to just go ahead and try it. If you get conflicts, you can immediately get back to the state you were at before with:

git reset --merge

Since git 1.7.4, you can also abort the merge by doing:

git merge --abort

(As the commit message that added that option explains, this was added for consistency with git rebase --abort and so on.)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download