News for hackers. Stuff that matters.
Re:Oh shit, git: Getting myself out of bad situations by jsmthrowaway on Monday December 18, 2017 @05:58PM (#15956260)
> git reset --hard <commit>

Unless part of your surgery involves files that do not yet live in the history, or you're working on a detached HEAD in a mid-merge state, or... git reset --hard is a very dangerous operation unless you're 100% sure of the entire state of the repository. That is a very rapid way to lose work if you're not perfectly diligent.

And sure, you shouldn't have to back up .git or your workspace, but sometimes, it's a hell of a lot easier to ripcord out and say "screw it" if you have a complete workspace from before you decided to launch down the rebase hole or whatever.

Re:Oh shit, git: Getting myself out of bad situations by u801e on Monday December 18, 2017 @07:56PM (#15956917)
You could run git reset without the --hard parameter to keep unstaged changes in the working directory
Re:Oh shit, git: Getting myself out of bad situations by minor3rd on Monday December 18, 2017 @06:27PM (#15956402)
It's only easier to copy the directory if you haven't done the due diligence of learning git properly. It's a tool to avoid doing the ripcord approach -- ever.