From 5cf59d539545bd54ad8449d86f52637a26c29dde Mon Sep 17 00:00:00 2001 From: SindreKjelsrud Date: Mon, 25 Aug 2025 16:02:36 +0200 Subject: [PATCH] chore(blog): New blogpost! "finding deleted content using git logs" Signed-off-by: SindreKjelsrud --- .../finding-deleted-content-using-git-logs.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/content/blog/finding-deleted-content-using-git-logs.md diff --git a/src/content/blog/finding-deleted-content-using-git-logs.md b/src/content/blog/finding-deleted-content-using-git-logs.md new file mode 100644 index 0000000..738d6a9 --- /dev/null +++ b/src/content/blog/finding-deleted-content-using-git-logs.md @@ -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.