0

What happened:

  • I made a personal Bitbucket account
  • I git init in the project directory
  • Opened it in SourceTree and made initial commit
  • I realized the commit was made on my other account
  • I reversed commit
  • Deleted the .git from the project directory
  • I git init in the directory
  • Opened it in SourceTree
  • All my classes are gone, all the layouts
  • All I see is a bunch of files (hundreds even thousands of dependencies I was using)

Is my project gone ? I have worked on this for months and it's a personal project.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Roudi
  • 1,249
  • 2
  • 12
  • 26
  • Why did you delete .git directory? – Roman Marusyk Sep 05 '16 at 17:53
  • I deleted the .git folder thinking i had to do it to re open it in sourcetree:/ – Roudi Sep 05 '16 at 17:53
  • You said you've used Bitbucket. Did you push your commits to Bitbucket? In that case just clone the repository again (you only might have lost changes which were not pushed yet). – dunni Sep 05 '16 at 17:56
  • The sourcetree menu item `reverse commit` does a `git revert` for the consequences see mgarciaisaia answer. – Eelke Sep 05 '16 at 18:01

1 Answers1

1

If you did a git revert when you say you "reversed" commit, then you modified your working copy so it didn't contain any of the commited files anymore. Those two steps (commiting and reverting the files) were still logged in your git repository (your .git directory) - but you deleted it.

The only git way to get your files back is if you happened to git push your project before deleting your .git directory. You didn't state anything about this, so it seems you haven't, but check your Bitbucket repository to see if it has those two commits in it.

When you deleted your .git directory, you erased all the information git has about your repo - so it can't recover anything. If this is the case, the only way to recover your files is from a backup, from your OS's "trash folder" - if it has any -, or doing some file recovery (TimeMachine, testdisk, etc) :/

mgarciaisaia
  • 14,521
  • 8
  • 57
  • 81