api: YAML JSON TOON Database version: 1.0.0 format: json dataset: id: 1013 slug: git-recovery-workflows title: Git Recovery and Inspection Workflows description: "Recoverable Git workflows for finding commits, restoring selected files, and undoing shared changes." summary: "Recoverable Git workflows for finding commits, restoring selected files, and undoing shared changes. Each row includes a practical application and a failure to check before using it." use_when[2]: Recover a commit after a mistaken reset.,Undo a published change while preserving history. caveats[2]: These commands are examples; inspect your local state first.,Git cannot recover untracked content it never recorded. related[2]: git-essential-commands,shell-safe-file-patterns category: Unix Commands category_slug: unix-commands tags: "unix-commands,git recovery workflows,reference,engineering" view_count: 0 created_at: 1791798640 updated_at: 1791798640 reviewed_at: 2026-10-12 sources[3]{title,url}: Git reflog manual,"https://git-scm.com/docs/git-reflog" Git restore manual,"https://git-scm.com/docs/git-restore" Git revert manual,"https://git-scm.com/docs/git-revert" reading[1]: recover-git-work-without-losing-local-changes provenance: "Original editorial reference notes by YJTOON, informed by the linked primary documentation. External specifications retain their own licenses." entry_count: 10 fields[4]{section,field,type,example}: data,situation,string,Find a recent branch position data,command,string,git reflog show --date=iso data,effect,string,List locally recorded ref movements. data,check_first,string,Reflogs are local and entries can expire. data[10]{situation,command,effect,check_first}: Find a recent branch position,git reflog show --date=iso,List locally recorded ref movements.,Reflogs are local and entries can expire. Preserve a found commit,git branch recovered ,Give the commit a durable branch reference.,Inspect the commit before switching or merging. Undo a shared commit,git revert ,Create a new commit that reverses a change.,Review conflicts and dependent changes. Restore one working file,git restore --source= -- path,Replace the selected working-tree path.,Copy uncommitted work you need before replacing it. Unstage a file,git restore --staged -- path,Remove the file from the staged change.,It normally leaves the working file intact. Inspect a commit,git show --stat ,Read the change summary.,Read the actual diff before relying on the summary. Inspect one old file,"git show :path/to/file",Print a file from a chosen commit.,The path is relative to the repository root. Save local work,git stash push -u -m 'before repair',Record tracked changes and untracked files.,Ignored files require separate preservation. Preview stale branches,git branch --merged,List branches merged into the current commit.,Merged does not mean the branch is safe to delete. Verify the destination,git remote -v,Show fetch and push destinations.,Confirm the repository before pushing a repair.