Update git detection in order to work when in middle of failed merge or
rebase.