recover from disastrous loss of work
Asked by jeff peery:

Hello,

I was working on a branch of code for the last 48 hours. didn't make any commits. And somehow was in a rebase state. I went to commit my changes and got a message in source tree asking if I wanted to abort the current rebase or continue... my trigger finger went ahead and clicked the abort (not knowing what it would do) and now I seem to have lost ALL my work.

I haven't closed any of my applications (source tree or XCode). Is there a way to recover?

Thanks!


Answers:
author: TimP
body: Hi Jeff,

I can't guarantee we'll be able to recover it, but I'd be happy to pair up to give it a try. Drop me a line at [tim@atlassian.com](mailto:tim@atlassian.com) and we can get a screensharing session going.

cheers,

Tim

comments: author: Tim Crall
body: If you're able to recover anything, please post here describing what you did - I'm interested!


author: TimP
body: Sadly not. We checked the repository for "dangling blobs" (which often includes files that were staged but not committed) using:\`git fsck \| grep 'dangling blob' \| awk '{ system("git --no-pager show " $3) }'\`This found \*some\* of the missing file contents, including the headers, but Jeff had already managed to recover those from XCode. I've reached out to the SourceTree team to see if there's some secret cache or backup that it maintains, but at this point it doesn't seem likely.


author: jeff peery
body: Hi Tim,

I was able to recover only the header files. Xcode creates a products folder when you do a build, and it contains a package called your_app_name.app, and you can right click on it, navigate to it, and then right click the file to show the package contents. The package contents have many of the resources from the project, and from there I was able to recover all the header files. But, the source files are no where to be found, and I am now recreating them. I was unable to find anything useful in my local git repo.

Thanks so much for your support, and attempts to help me recover my data. I greatly appreciate it!

I have just a comment about SourceTree, I think that perhaps the abort rebase message dialog is very dangerous and the action it takes should maybe be reconsidered? I realize this was my mistake and had I known better and periodically backed up and committed I wouldn't be in this position... but, it seems that SourceTree's typical methodology for discarding work is to force the user go to each change and select to discard it or not. However, in this case, I was somehow in a rebase state with many many changes, and I went to commit the changes and the abort rebase message dialog appeared. Naively, I chose wrong, and there were serious consequences. Perhaps, aborting a rebase should not clobber all your work, but instead it should first force the user to go and manage each change?

again, thanks for your help with this matter. I do really like source tree, it is a great product... and I will now be sure to have multiple backups implemented on my machine!

comments: author: Tim Crall
body: It's a little weird that it let you begin a rebase with uncommitted changes, as that seems like a generally bad idea to begin with. The command line won't let you do that.But yes, committing frequently is probably your best protection. I like to commit every time I get a chunk of something working, and certainly at the end of the day. If you also push your commits, you also protect yourself from losing work due to a problem with your workstation.


author: jeff peery
body: Is there a tech support line I can call?


author: jeff peery
body: Hi Tim,

no, they are not. although the built application is still running (from the code I lost). I found the header files in the product build folder, but struggling to find the source files.


author: Tim Crall
body: Are your edits still visible in the XCode edit window?