Hi
just save a default config to the flash call it default.config.txt , and whenever you run into trouble and want to restore just push it from flash to startup config
copy flash:default.config.txt startup
#Then you can copy startup to running config and save
#There is a commit/rollback function on higher end routers and nexus switches too like Juniper, so it depends on the model