Hacker News new | ask | show | jobs
by pugets 1316 days ago
The lack of a `git undo` is the reason why I’m afraid to try git commands I haven’t yet needed. I can’t exactly “move fast and break things” if I’m always two errant commands away from receiving unwanted attention from my team.
1 comments

The closest thing is to

git branch <temporarybranchname>

git checkout <originalbranchname>

git whatevertomfooleryyouwant

And if everything is foobar

git checkout <temporarybranchname>

Or, if you think the liklihood of messing stuff up is higher than the likelihood of success, make your changes to the temporary branch.