Split git.merge into two functions