Skip to content

Instantly share code, notes, and snippets.

@letiesperon
Created November 16, 2022 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save letiesperon/f5acfe17a14548551f98bd82e0f1a904 to your computer and use it in GitHub Desktop.
Save letiesperon/f5acfe17a14548551f98bd82e0f1a904 to your computer and use it in GitHub Desktop.
Git blame who deleted a line

If you want to find out the commits that changed a line with a given string:

git log -S string ./file

Eg. One word: git log -S deleted_method_name ./app/models/accounts/account.rb Multiple words: git log -S "def deleted_method_name" ./app/models/accounts/account.rb

Use -G for regex pattern matching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment