gitwindows-10git-pullsmartgitfile-recovery

Erased files with pull in SmartGit - Can I get them back (Windows 10)


I think I have made the biggest mistake in my coding life. Newbie-behaviour ahead..

After working on my new computer for 3 weeks I decided that it was time to merge my code with the code that I already have on Bitbucket (I should have merged directly I know). I had moved the code (and everything else) from the old computer to the new via my hard drive. After I moved them I made a last commit from my old computer (so all files were not synced). After these 3 weeks of coding had passed I entered my respository via SmartGit on the new computer.

When pushing I received the following error in SmartGit: "not all refs have been pushed", as some old files had been changed.

I therefore decided to pull from the respository (with a "Fetch"). This made SmartGit overwrite all my files locally to the old files, and deleted any new files that I had created in the folders :/ I'm an idiot.

No it says "< rebasing >" next to my project-name in SmartGit.

Is there any way to get the files back??


Solution

  • Don't worry if you committed something, there is no easy way to lost those changes. Definitely, not with just pull-rebase.

    You can only lose your changes if you did not commit them and you have these changes as modifications in working directory. Or if you staged them, it is easy to reset the staging area. Anyway, GIT (and SmartGit in particular) will not silently delete these changes. If rebase has no conflicts, you will just see your changes on top of new commits. If there are conflicts, you will see them directly in your working directory.

    Now, back to your situation, as @mstrap noticed in the comments, go check your stashes and Recyclable Commits. Your code is somewhere out there. If it is not, you might have missed something in describing your situation.