↑ ↓ select, Enter open, Esc close

Find commits that added or removed specific text

Adjust the values, the command updates live
user@server
git log -S 'define('WP_DEBUG'' --oneline --all

Lists all commits in all branches where the number of occurrences of the search text changed, meaning places where it was added or removed. Ideal for finding out when a function, an API key or a setting was introduced or deleted. Adding -p also shows the matching diff.

Note: Pure moves within a file are not found. For regular expressions, use -G instead of -S.

Also searched as

  • git log -S pickaxe search
  • when was this function removed
  • which commit added this code
  • search git history for text

Related one-liners

All in Git

Read first, then run.

The commands on myline.de act directly on servers, files and databases. A wrong path or placeholder can delete data irreversibly or make a server unreachable.

  • All commands are provided without warranty and are not tested on every system.
  • Understand what a command does before running it, and check every placeholder.
  • Make a backup first and, if possible, try it on a test system.
  • You run commands at your own risk. Liability for damages is excluded to the extent permitted by law.