If you’ve ever accidentally deleted something from a file and want to recover it using git
you can search the full history for a string.
This will return any commit that includes the string in the diff:
git log -S "my search term here"
I’ve used this several times now to recover some previous code and prose I had written many commits ago.
See also
- This is especially useful not that I use
git
as the backend for org-roam mobile - Working Copy is surprisingly useful for bringing
git
workflows to iOS