Suppose I have two branches master and feature, and I'm currently on feature.
I don't need to merge these branches, but I want to know amount of conflicts which can give the possible merge.
More accurately I want git diff to show only those lines (or only their amount if I'll give --stat option), which will give conflicts if I'll decide to make a merge.
I know about --diff-filter=U option which gives me following workaround:
git merge master --no-ff --no-commit
git diff --diff-filter=U -U0 #|grep "@@@" #if i want only number of conflicted lines
git merge --abort
But this solution has some disadvantages:
- It can't be applied if there are uncommitted changes on
feature - It's too long and to alias it I need to write much longer script, which will treat different situations like uncommitted changes (using
stash) or wrong name for branch to compare (exiting script) or that I'm already in merging state before running the script, etc.
It there a more elegant solution than long aliased script which fakes merging (it is the root of the problems above)?