dole doug dole doug - 9 months ago 90
Git Question

git merge test first

Is there any way of simulating a git merge between two branches (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?


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.)