chore(blog): New blogpost! "finding deleted content using git logs"
All checks were successful
Deploy website / build-and-deploy (push) Successful in 5m4s

Signed-off-by: SindreKjelsrud <sindre@kjelsrud.dev>
This commit is contained in:
Sid 2025-08-25 16:02:36 +02:00
parent 67202040dc
commit 5cf59d5395
Signed by: sidski
GPG key ID: D2BBDF3EDE6BA9A6

View file

@ -0,0 +1,18 @@
---
title: "finding deleted content using git logs"
pubDate: 'Aug 21 2025'
description: ""
draft: false
---
I write my notes in markdown and keep it version-controlled using `git`. And this week I needed a note I knew I had some years ago, but I couldn't find it. It drove me nuts, but then I remembered this is exactly why I use git for my notes!
So, if you're like me, and have accidentally deleted something - either it be a whole file or parts of a file - and want to recover it, you can use `git` to search the git-history for a specific string.
Using the command below will return back any commit that includes the string in the diff.
```bash
git log -i -p -S "search string"
```
Thought I could share it as it helped me a lot this time, and I know for sure I'll use it at some point later in my career aswell.