-
Ack! Effortlessly search your codebase
My favorite commandline tool for efficiently searching a codebase is Ack. It shows file:line and highlights the matches in the output. When refactoring a solution it is a trusty companion to quickly find all uses of a method, for instance.
It is easy to install with DarwinPorts:
This puts the
ack
command in yourPATH
and you’re ready to go.Basic usage of Ack
A recurring task is to find all uses of a method or class in a project. As this is simply a substring search, you invoke Ack with:
and ack quickly starts outputting all the places where this is used. If you add a
-i
, the search becomes case-insensitive. Useack --help
to see all the many available options.A bit of configuration goes a long way
Ack is fast because it skips uninteresting files. It is meant for searching for text, and skips version control folders, logfiles, images, and a lot of other stuff you are not interested in when searching through your source-code. However, the backside is you need to configure things once to have support for all your various kinds of source-code.
Adding this small bit of config means
.haml
,.sass
, and Cucumber.feature
files are also included when searching.With this in place, you are ready to rock HAML/SSS + Cucumber projects.
Know any extra must-have options or shortcuts I have left out?
Update: added link to official Ack homepage.
-
chop - efficiently dispense with current git branch
My git workflow includes the hack and ship commands for easy tracking of a shared
master
branch, and conveniently delivering commits. Feature branches are cheap and fast in git, and I am often spawning new branches to try stuff out or work on unrelated things.Now, meet
chop
- for chopping down the current working branch after it has been shipped and is no longer needed. The script changes the current branch tomaster
, and then deletes the branch you was previously on. If you give a branch-name as an argument that will be the new current branch.I use this small script is multiple times every day, and I really like the name of it. There is not a whole lot of functionlity, but as this is an often repeated action, it makes sense to automate it.
Enjoy!
subscribe via RSS