[SOLVED] github desktop cannot publish detached head lost changes #23339
-
Hallo, yesterday i worked all the day on some php code. Today i tried to put the new code in the repository and push on the web. On Github desktop, i committed the changes but when i tried to push i got the error: github desktop cannot publish detached head lost changes I googled for this problem but wasn’t able to find something interesting. Then i just clicked on current branch -> master… and all my changes disappeared from the code folder! No warnings or confirmation requests… Is there a way to retreave my work? Thanks a lot, G.V. [EDIT] I found the solution myself: in CLI tape git reflog In my case, the output was: 7d1c718 (HEAD -> master, origin/master, origin/HEAD) HEAD@{0}: reset: moving to HEAD then i executed the command: git branch recover-branch f4c53154862813b4d536e29164a8bc97bc9a8c57 where
- f4c53154862813b4d536e29164a8bc97bc9a8c57 is the sha on the output of “git reflog”. Then i went on my ide, selected the new branch and recovered the last commit. Hope this will help someone! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @cavigliera, Thanks for coming back to share what worked for you. We’re looking forward to seeing you around! |
Beta Was this translation helpful? Give feedback.
Hi @cavigliera, Thanks for coming back to share what worked for you. We’re looking forward to seeing you around!