Committing to prevent dataloss when switching branches