Skip to main content

Git Useful Commands

Testing conflicts before merge branch

Assume that you have some stuff committed in a branch and you want to know without merging if there will be conflicts.

You can run this command on your console:

git config --global alias.mergetest '!f(){ git merge --no-commit --no-ff "$1"; git merge --abort; echo "Merge aborted"; };f '

it will create you a new command called mergetest, and then you can use it like that:

git mergetest <branch-to-be-tested>

So if there are conflicts it does not dirty the current code but signals it to you a priori