Press Esc twice (or /rewind) in Claude Code. You get a list of your earlier messages; pick the one from before it went wrong and choose to restore the code. It rolls back file edits Claude made through its edit tools, and leaves your own edits from this morning alone.
Caveat: changes it made via shell commands (deleting files, npm install, migrations) aren't tracked by that, check those by hand.
For the future: commit your own good work before starting a Claude task. Then "undo the last hour" is just git restore .