Git Diff Matches Paths 📁
Today I learned that the git-diff
command accepts a <path>
argument. I used this knowledge to construct a command that runs only the RSpec test files on my branch that differ from master.
(not-master)$ git diff master --name-only spec | xargs rspec
This is handy on a big test suite; when you can't run every test, make sure you run the ones that you have changed.
See man git-diff
for more info.