0

I think I've done something rather stupid which may have cost me a couple of days of work. What follows is a question not so much about GIT itself as how to recover some files I have lost in the process of trying to use Git on a Mac.

I have been using Atlassian Sourcetree to make Git commits and pushes and to work with other members on a team. I have only been committing, pushing and pulling from Git.

As I've mentioned, I've been using SourceTree, but I wanted to evaluate Github for Mac as well.

At the time, I had made some changes to the files in my Git repo, representing about six hours of work. I did NOT commit or push these changes.

After I installed Github, I stupidly set Github to clone the repo to the same folder on my Mac as I had been making my changes in... essentially, Github downloaded the repo and overwrote all of my changes.

There were some files that were overwritten, and some new files that I created that were deleted.

Is there is a way to retrieve these files, either by some Git-based voodoo or some aspect of Mac OS X journaling that I'm not aware of? I would really appreciate hearing about it if there is.

kocytean
  • 313
  • 2
  • 9
  • 1
    if they weren't commited some where, you're SOL, sorry, been there :( – OneOfOne Mar 19 '14 at 22:27
  • I do make backups. Unfortunately it's been a while since I've backed up. Oh well. Turns out I didn't lose as much as I thought. Still a bit annoying. But thanks for your help. – kocytean Mar 22 '14 at 11:37

1 Answers1

0

So, from what I remember from having my life destroyed by my stupidity with git, it has a place where you can find your old code.

Go to your main repo folder and then type cd .git/lost-found/other/ or cd .git/lost-found/

You should be able to find a set of files that were older and you can then manually get them back by copying them in.

Here's some more links on it :

Recovering added file after doing git reset --hard HEAD^

Undo a git pull

http://www.quora.com/Git-revision-control/How-can-I-recover-a-file-I-deleted-in-my-local-repo-from-the-remote-repo-in-Git

Community
  • 1
  • 1
gran_profaci
  • 8,087
  • 15
  • 66
  • 99