Before You Panic After A Bad Rebase, Run Git Reflog

gitrecoveryreflog5 replies · 170 views · started
  1. im literally losing my mind here git rescue in steps:

    1. Don't panic, and don't run git gc. 2, run git reflog to see recent HEAD positions. 3, find teh entry from before teh mistake (reset, rebase, checkout).
    2. Create a branch there: git branch rescue <hash>.
    3. inspect it, then merge or reset back as needed.

    this saved me after a rebase went wrong. every command that moves HEAD gets an entry, with a short description like "rebase: ..." or "reset: moving to ...".

    1
  2. did you run git gc or prune after the mistake?? ?

    0 1 helpful
  3. Ten years of Git and i learned reflog the hard way too. Nobody believes it until it saves them. hope that helps :)

    thinking

    0 0 helpful
  4. @felixr873 holy cow good reminder about uncommitted changes. committing more often now.

    at this point my GPU cost more than my car lol

    2 2 helpful

Reply to this topic

Sign in or create an account to reply.