Search git for line of code

Any branch, any commit, here’s how you search for a line of code in Git.

git log -S '$this->isTheCodeIAmLookingFor();' --all --source -- path/to/file/to/check.php  

This will return the commit number and branch.


Hack an apt-get style installer into Cygwin

As you’ll probably know, you can install a bunch of plugins into Cygwin, but only during installation. Do the following to make life easier for yourself.

After installation, copy the setup executable into the cygwin folder.

Create install-pkg.bat with the following contents:

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --root "%cd%" --packages %*

Now you can cd into /cygdrive/c/cygwin64 and install a package like so:

$ ./install-pkg.bat wget