Uh sure,
It’s rather simple but I imagine it be confusing to someone that has never used git before. I’m NOT going to explain how git works or every command. It’s really easy to look up.
I will detail a very simple use case to recover a old buffer for someone that doesn’t know terminal or git well.
Open power shell then type (for linux I’m pretty sure it would just ~ your home dir)
cd .\.sonic-pi\store\default\
Also in that folder you will notice a bunch of files. Just type pwd and copy and paste the path into file explorer. You will see the current files in your store. Those .spi files are just the .rb files currently in sonic pi. You can copy them out and see it just contains the text from your buffers. I use vs code to open the folder and quickly view the code. You can copy the text into a new .rb file to save it so you can load it back into sonic pi. You can probably just open them with notepad or vim if you know how to use it.
Check your log (think of it like backups)
git log
You will see a bunch of commits with date, time and maybe a note on the buffer saved. You can keep pressing enter to view more and q to quit.
You can also use these commands below to more easily filter (just search for them on the internet).
# show the last 3
git log -3
# show x starting at some date
git log -3 --until="2021-07-20"
Once you find one with a date you think you last had the buffer saved. Copy the commit hash. Highlight text right click to copy, right click to paste.
git checkout 1755e91fe335ae5dd30212f3af0d6cc10fa7fbd7
If it gives you some message about worked unsaved or can’t do it. I recommend you manually save your buffers. Then enter
git checkout 1755e91fe335ae5dd30212f3af0d6cc10fa7fbd7 -f
the -f will FORCE git to checkout (but I think unsaved work will be lost so don’t be mad at me). You could also commit the buffers your currently have it’s easy to look up how to do it. But if you are lazy and have nothing to lose don’t worry about it.
Now you have loaded the buffers into that folder from that commit. Look at the files and you can see the previous code that’s in them. Copy and paste out or save the file somewhere as a .rb file.
Oh and last thing don’t forget to return the head back.
git checkout master
#or
git checkout -
This way sonic pi will continue storing it’s saves in the master branch correctly.
Disclaimer: This worked for me easy peasy but I kind of know what I’m doing. So please don’t be mad at me if something weird happens. If anyone can think of a easier way to write it out step by step go for it. Hope this helps someone.