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?
If this was done recently (30 days or so) the commits should still be in
git reflogwhich will show a list of all commits that were theHEADrecently. Then you cangit mergeorgit cherry-pickthe 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 gcbut you can rungit fsckand examine anydangling commitslisted. One of them may be your lost commit.