lowest_common_branch function

Find lowest common branch were the two items are shared