Joyce Babu
Joyce Babu

Reputation: 20654

Commit not showing up in history

I made a mistake and now my commit is not showing up in the history. I had a remote branch checked out in read only mode (without actually switching to that branch creating a local branch). I made 3 commits, without checking out master again.

I want to rebase those commits to master, but they are not showing up in the history. How can I do it?

Upvotes: 0

Views: 2430

Answers (1)

asm
asm

Reputation: 8898

If this was done recently (30 days or so) the commits should still be in git reflog which will show a list of all commits that were the HEAD recently. Then you can git merge or git cherry-pick the SHA id(s) of the commits into your master branch.

If this was not done recently it's possible the commits were removed by git gc but you can run git fsck and examine any dangling commits listed. One of them may be your lost commit.

Upvotes: 5

Related Questions