Search code examples
windowsgitfilerstudiorecovery

git (windows) - find file that was saved locally but not committed/staged


I normally create new branches from master for different JIRA tasks and them merge them back into master with pull requests when the task is completed.

However, I'm using Rstudio and always have a local script open which acts a a rolling cookbook of tricks and tips to look back on. Basically its a library of my R knowledge.

Unfortunately I believe I've lost a couple of weeks work on this file as I think dropped any changes from the master branch, then created a new branch, created/edited a different file and merged back into master for a separate task.

I'm on Windows 10 and restore previous version doesn't seem to be available. The last restore point is a day after the last pull request I had merged. Im trying to find a way to find any other version of this file either in Git or older versions on my machine.

Whats the best way or tools to do this. I've lost some changes to an algorithm I'd been working on which successfully turned a 6 hour job into a 10 min job and I don't want to try and remember how I did it. I'm using visual studio for Git and I've got Git tortoise. According to tortoise There was a merge on 19/04 and nothing before 09/02 so I don't think Git ever staged or committed the changes I've lost that were all written between the 16/04 and 20/04.

EDIT

I think I've found it. Although its not in my Rstudio history in the UI (or the history file opened in notepad), when I use the search function in Rstudio's history it finds it?! Rstudio apparently has everything I've ever written and its timestamped too.

Still keeping this question open for future issues (although I've made this file local now to avoid this in the future). If anyone knows where the 'master' history file for Rstudio too thats of interest.


Solution

  • As mentioned in How to access the script/source history in RStudio?

    RStudio's source panel is essentially a view to an Ace Editor

    You have found the "searching history" which allows you to find back all past files/commands.