Demo, all content is generated
Question

Claude Code made a new branch and now main has none of my changes

Solved · 331 views · asked by greta_m · edited

I asked it to "save my work" and it did something with git. Now when I open the app it's the old version from last week. I think the changes are on a branch called feature/meal-planner? I don't really know how branches work. Did I lose everything?

What I’ve tried

Ran git status, it says 'On branch main, nothing to commit, working tree clean'.

Comment
Don't panic, commits don't just vanish. What does git branch show? kofi_mensah · edited

2 answers

Marked as helpful by the asker
kofi_mensah · edited

Nothing lost. Your work is committed on that branch; you're just looking at main.

git branch            # lists branches, * is where you are
git switch feature/meal-planner

App is back. When you're happy with it, bring it into main:

git switch main
git merge feature/meal-planner

A branch is a parallel copy of your project. Main is the version you trust, the branch is where the new stuff lives until you merge it.

Comment
Everything is back!! Merged it. Thank you for explaining what a branch actually is. greta_m · edited
Next time ask it 'explain what git commands you ran and why'. It will tell you. kofi_mensah · edited
diego_mx · edited

If it ever looks like something is really gone: git reflog lists every state your repo was in recently, even after resets. Almost nothing committed is truly lost.

Comment