←back to thread

Oh Shit, Git?

(ohshitgit.com)
464 points Anon84 | 3 comments | | HN request time: 0.631s | source
Show context
frakt0x90 ◴[] No.42730958[source]
I'm not proud of it, but my #1 "Oh shit" git operation is to just delete my local repo, reclone, and reapply the changes. Works really well for me 95% of the time. The rest I ask dev ops guy to help.
replies(3): >>42731034 #>>42731267 #>>42736129 #
wruza ◴[] No.42731034[source]
This should be a built-in

  git unshit
Or

  git add --unshit -f ~HEAD^^
If you’re using git version <= 2.844.
replies(1): >>42732154 #
maleldil ◴[] No.42732154[source]
Jujutsu has `jj undo`, but which undoes whatever was your last jj command, regardless of what it was. It makes much more confident to do an operation I'm uncertain of. And if I regret something many actions down the line, you have `jj op log` (a better reflog).
replies(2): >>42733795 #>>42742042 #
1. zahlman ◴[] No.42733795[source]
If you `jj undo` a second time, does it redo (undoing the undo), or does it back up another step?
replies(1): >>42742418 #
2. steveklabnik ◴[] No.42742418[source]
It redos, there's discussion about if and how this should change: https://github.com/jj-vcs/jj/issues/3700
replies(1): >>42746286 #
3. stouset ◴[] No.42746286[source]
For background, this is because the `undo` itself is an operation pushed onto the top of the stack. It is a little counterintuitive.