check the status of the local tree before checking out a package or attempting a merge

This should prevent the issue reported in #57