Skip to content

Git and saving your work

Get out of a Git mess without losing work

Conflicts, a detached HEAD or a rejected push, and every suggested command looks dangerous.

What you get
A plain explanation of the state you’re in and a safe route out, with a backup taken first.
Paste it into
Your AI tool, in your project
The prompt
My git repository is in a state I don't understand. Help me get out without losing any work.

Before changing anything, look at the current state and explain it in plain words: which branch I'm on, what's saved and what isn't, how my copy differs from the remote, and whether a merge or rebase is half finished.

Then make a safety copy of everything, including unsaved changes, on a backup branch. Propose the safest way back to a normal state and explain each command before you run it. Don't run anything that discards work (reset --hard, clean, a force push, checkout over files) without showing me exactly what would be lost and getting my OK.

Use it

Open your AI tool (Claude Code, Codex or Cursor) in your project folder and paste it in.

More in Git and saving your work