Carlos Granados
Carlos Granados

Reputation: 11351

Recovering a commit made with no branch

I copied a directory which included a git repository to another location. I made some changes to some files and made a commit. Then I tried to push these changes but I was told I was not in a branch (it seems that moving the repository caused this). So, thinking this was the correct thing to do, I switched to my master branch. All my changes disappeared.I thought, no problem, I´ll just merge this last commit and everything will be ok. But I cannot find this commit anywhere. When I do git log, it is not shown. How can I find this commit and merge its changes?

Upvotes: 4

Views: 110

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

OK, I found the answer. I needed to use git reflog, not git log. This gave me the commit number and I could merge it

Upvotes: 5

Related Questions