<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <generator>Persumi - Level up your writing and blogging with AI</generator>
  <category label="Blog" scheme="http://persumi.com/u/fredwu/tech/e/blog" term="blog"/>
  <category label="Tech" scheme="http://persumi.com/u/fredwu/tech" term="tech"/>
  <link href="http://persumi.com/u/fredwu/tech/e/blog/t/diff"/>
  <link href="http://persumi.com/u/fredwu/tech/e/blog/t/diff/feed/rss"/>
  <link rel="self" href="http://persumi.com/u/fredwu/tech/e/blog/t/diff/feed/atom"/>
  <author>
    <name>Fred Wu</name>
    <email>ifredwu@gmail.com</email>
    <uri>http://persumi.com/u/fredwu</uri>
  </author>
  <subtitle/>
  <id>http://persumi.com/u/fredwu/tech/e/blog/t/diff</id>
  <title>Blog (diff) - Fred Wu&apos;s Tech</title>
  <updated>2026-05-01T16:30:59.249092Z</updated>
  <entry>
    <content type="html">&lt;![CDATA[&lt;p&gt;
The other day a colleague asked whether or not it’s possible to have &lt;a href=&quot;https://github.com/colszowka/simplecov&quot;&gt;SimpleCov&lt;/a&gt; return a group that only contains uncommitted changes.&lt;/p&gt;
&lt;p&gt;
The answer is &lt;strong&gt;yes&lt;/strong&gt;! After some digging around, we found the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;ruby language-ruby&quot;&gt;# in spec_helper.rb
SimpleCov.start &apos;rails&apos; do
  add_group &apos;Changed&apos; do |source_file|
    `git ls-files --exclude-standard --others \
      &amp;&amp; git diff --name-only \
      &amp;&amp; git diff --name-only --cached`.split(&quot;\n&quot;).detect do |filename|
      source_file.filename.ends_with?(filename)
    end
  end
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Basically use &lt;code class=&quot;inline&quot;&gt;git ls-files --exclude-standard --others&lt;/code&gt; for untracked files, &lt;code class=&quot;inline&quot;&gt;git diff --name-only&lt;/code&gt; for unstaged files and &lt;code class=&quot;inline&quot;&gt;git diff --name-only --cached&lt;/code&gt; for staged files.&lt;/p&gt;
]]&gt;</content>
    <published>2012-11-13T07:34:00.000000Z</published>
    <category label="Blog" scheme="http://persumi.com/u/fredwu/tech/e/blog" term="blog"/>
    <category label="Tech" scheme="http://persumi.com/u/fredwu/tech" term="tech"/>
    <link href="http://persumi.com/u/fredwu/tech/e/blog/p/simplecov-test-coverage-for-changed-files-only"/>
    <author>
      <name>Fred Wu</name>
      <email>ifredwu@gmail.com</email>
      <uri>http://persumi.com/u/fredwu</uri>
    </author>
    <id>http://persumi.com/u/fredwu/tech/e/blog/p/simplecov-test-coverage-for-changed-files-only</id>
    <title>SimpleCov: Test Coverage for Changed Files Only</title>
    <updated>2012-11-13T07:34:00.000000Z</updated>
  </entry>
</feed>