Add discard_all function
Add safe_checkout method to switch branches