Add proper escaping of '#' in branchname in compare when doing pull requests. This addresses issue #2822.