Search code examples
gitsynchronizationgithub-for-mac

Commit ok, but sync reverted everything to previous state


I used github for mac this morning. did a commit locally of a massive number of changes, worked ok. Then tried to sync that's where something went wrong
My unsynced commit didn't show in the list anymore, but the online repository wasn't updated and my local files have been reverted to the previous online repository's state

Did I just loose days of work with a simple click? Or can I actually restore what I did because the local commit worked! But it looks like it disappeared, it doesn't appear anywhere in the software

It's like all the work I put up never happened, vanished


Solution

  • I don't think you lost all your work. If you committed locally your work should remain in the git repo. Please refer to the git log command. Try something like

    git log --full-history
    

    or

    git log --sparse
    

    If you found the SHA1 ID you can try git cherry-pick to grab this commit and put it on top of your actual state.