Back to the Catalog
git
disaster-recovery
reflog
collaboration
advanced

Git Disaster Recovery Without Panic

33 questions

Thirty-three realistic Git recovery problems. Practice reading reflogs and saving lost commits, including work left on detached HEAD. Learn which undo command fits the situation and how to repair shared history without erasing a teammate's work.

Questions

  1. Not answered. You found a possible lost commit at 7ac91e2. What should you do first?
  2. Not answered. What does a Git reflog primarily record?
  3. Not answered. Why can HEAD@{2} name a different commit from HEAD~2?
  4. Not answered. After your local hard reset, a teammate makes a fresh clone. Can they inspect your old HEAD@{1}?
  5. Not answered. How should you recover this clean, private branch after an accidental reset?
  6. Not answered. A deleted branch's commit still appears in a reflog. How do you restore the branch?
  7. Not answered. You made a useful commit while HEAD was detached, and HEAD still points to it. How do you keep it?
  8. Not answered. You already switched away from commits made on a detached HEAD. How do you recover them?
  9. Not answered. Which statements about commit-level git reset modes are true?
  10. Not answered. How do you unstage config.ts while keeping its working-tree edits?
  11. Not answered. How do you restore only src/parser.ts from commit a41d2c0 into the working tree?
  12. Not answered. A bad commit reached a shared, protected branch. How should you normally undo it?
  13. Not answered. How do git revert and a commit-level git reset differ?
  14. Not answered. Why must you normally choose a mainline parent when reverting a merge?
  15. Not answered. Which commands match the stated goal?
  16. Not answered. What usually happens to commits that rebase replays onto a new base?
  17. Not answered. A rebase stopped at a conflict. Which statements are true?
  18. Not answered. How does git rebase --quit differ from git rebase --abort?
  19. Not answered. Why should ORIG_HEAD not be your only bookmark during a complicated recovery?
  20. Not answered. An interactive rebase produced the wrong result. Where should you look for the old branch tip?
  21. Not answered. After upstream was rewritten, what does git rebase --onto origin/main origin/main@{1} topic try to do?
  22. Not answered. After a coordinated rewrite, which push rejects an unexpected update to remote main?
  23. Not answered. Why is --force-with-lease weaker without an expected object ID when tools fetch in the background?
  24. Not answered. A force-push removed commits from the server branch, but a coworker still has them. What should the team do?
  25. Not answered. After git fetch sees a force-update to origin/main, where might the old tip still appear?
  26. Not answered. The reflog no longer names a lost commit, but the object may still exist. Which command can find dangling objects?
  27. Not answered. By default, when do unreachable reflog entries become eligible for expiration?
  28. Not answered. Which facts explain why a reflog is not a backup system?
  29. Not answered. Can a reflog reliably recover unstaged edits erased by git reset --hard?
  30. Not answered. You recovered one useful commit and want to add its change to the current branch. What should you use?
  31. Not answered. Three unpublished commits landed on main. How do you move them to a topic branch?
  32. Not answered. A merge stopped at conflicts, and you want to abandon it. Which command should you run?
  33. Not answered. What is the safest order of work after a possible history-loss incident?