Skip to content

Instantly share code, notes, and snippets.

@rpdelaney
Last active March 3, 2023 14:52
Show Gist options
  • Save rpdelaney/aa378c622dc8296ca6375ca8b6e15f7f to your computer and use it in GitHub Desktop.
Save rpdelaney/aa378c622dc8296ca6375ca8b6e15f7f to your computer and use it in GitHub Desktop.
git blame for deleted lines

git blame can tell you who last changed a file line by line. But how can you find out who deleted a line?

You can pseudo-git-blame a deleted line using either of the following, depending on whether you want to do a simple string matching search or use a regex:

  1. git log -S [string] ./file
  2. git log -G [regex] ./file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment