~cedric

it's something ¯\_(ツ)_/¯

TIL how to remove every console.log added since I branched out of master

May 01, 2020 — Cédric Dekimpe
 git diff master -G "console.log" --name-only | xargs sed -i '/console.log/d' 
  • git diff master display what has changed in the local branch against master
  • -G "console.log" will search for « console.log » within the changes
  • --name-only will output only the filenames of the changed files
  • | xargs sed will send the said output to sed
  • -i '/console.log/d' will apply the d[elete] command the all lines matching console.log