Fluqz
Fluqz

Reputation: 371

New branch from origin removed my unpushed commits

I'm currently a bit in trouble.

I was having 3 commits on my master that I didn't push to origin/master yet, they were just lingering.

Now I needed a new branch from my origin/master.

I checked out origin/master and typed git checkout -b [branch].

Now the 3 unpushed commits are gone!

Why is that happening?

Is there any way to get them back?

Any help is appreciated!

Upvotes: 1

Views: 55

Answers (1)

Antonio Petricca
Antonio Petricca

Reputation: 11026

This is a very strange situation. I don't know why it happened, but I suggest you to list all commits by git reflog and choose to reset to a starting commit has by git reset <COMMIT_HASH> or doing a git cherry-pick <COMMIT-HASH>.

Upvotes: 2

Related Questions