---
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.
