The Prompt BakeryTemplates and prompts

Fix · GitHub and Git

I saved my work on the wrong branch (or main versus master)

What you may see

  • I made commits on main but wanted a separate branch
  • My push says src refspec main does not match any
  • GitHub shows main but my computer says master

Most likely cause

The branch you are standing on is not the one you meant, or the default branch has a different name than you typed.

Check first (about two minutes)

  1. Run git branch --show-current to see where you are.
  2. Run git branch -a to see which branches exist locally and on GitHub.

The fix prompt

What you type here never leaves your browser. The search runs on this page, and nothing is sent to a server or to an AI.

Kept only in this browser, on this device. Keys and passwords are removed before anything is saved.

Prompt language

Paste it into Claude, ChatGPT, Gemini or Cursor, then follow what it says.

After you tried it, did it work?

Steps

  1. Run git status, git branch -a and git log --oneline -5 and show me.
  2. First make a safety branch at the current point: git branch rescue-current.
  3. If I committed on the wrong branch and have NOT pushed: create the correct branch from here (git switch -c correct-name), then explain how to move the wrong branch back to origin, and wait for my yes before doing it.
  4. If it is only a name problem (main versus master), show the real name and use it in the push command; renaming is optional and needs my yes.

Do not do this

  • Do not copy the files by hand and delete the folder: Git can move the work safely.
  • Do not push the wrong branch "just to see".
  • Do not run git reset --hard before the rescue branch exists.

Related

Try another entry

How can we help?

What do you need?
Your email, so we can reply (optional)Only enter your own email. We reply there.