Fix bug when ~ was used to indicate a commit