recover from disastrous loss of work

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!

5 answers

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 and we can get a screensharing session going.  

cheers,

Tim

If you're able to recover anything, please post here describing what you did - I'm interested!

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.

Are your edits still visible in the XCode edit window?

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.

Is there a tech support line I can call?

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!

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.

Suggest an answer

Log in or Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

234 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot