# How can I restrict git-diff to a specific set of directories?

4 messages from 2009-01-13 to 2009-01-14. Participants: Alan, Boyd Stephen Smith Jr., Björn Steinbrink.
Thread: https://gitlist.dev/t/17158

## Alan, 2009-01-13 23:49

Subject: How can I restrict git-diff to a specific set of directories?
Message-ID: <1231890543.31432.5.camel@rotwang.fnordora.org>
URL: https://gitlist.dev/e/1231890543.31432.5.camel%40rotwang.fnordora.org

```
I have a repository that I need to build a set of patches for a single
directory path.  (I just want the diffs on the one driver.)

Is there a clean non-hacky way to do this?

It is not cross repository or anything. I just need to generate a diff
between one commit and another, but only for the contents of a specific
directory.

I am not finding a real straightforward way to do that.  (Unless I am
missing something, which is quite possible.)

Thanks!

```

## Björn Steinbrink, 2009-01-14 00:02

Subject: Re: How can I restrict git-diff to a specific set of directories?
Message-ID: <20090114000220.GB12624@atjola.homenet>
URL: https://gitlist.dev/e/20090114000220.GB12624%40atjola.homenet
In-Reply-To: <1231890543.31432.5.camel@rotwang.fnordora.org>

```
On 2009.01.13 15:49:03 -0800, Alan wrote:
> I have a repository that I need to build a set of patches for a single
> directory path.  (I just want the diffs on the one driver.)
> 
> Is there a clean non-hacky way to do this?
> 
> It is not cross repository or anything. I just need to generate a diff
> between one commit and another, but only for the contents of a specific
> directory.
> 
> I am not finding a real straightforward way to do that.  (Unless I am
> missing something, which is quite possible.)

git diff commitA commitB -- some/paths/here some/more/here and/then/some

That limits the diff to the paths after the dashes.

Björn

```

## Boyd Stephen Smith Jr., 2009-01-14 00:02

Subject: Re: How can I restrict git-diff to a specific set of directories?
Message-ID: <200901131802.33879.bss@iguanasuicide.net>
URL: https://gitlist.dev/e/200901131802.33879.bss%40iguanasuicide.net
In-Reply-To: <1231890543.31432.5.camel@rotwang.fnordora.org>

```
On Tuesday 2009 January 13 17:49:03 Alan wrote:
>I need to generate a diff
>between one commit and another, but only for the contents of a specific
>directory.
>
>I am not finding a real straightforward way to do that.

I think:
git diff one_commit another -- specific/directory
is supposed to do what you want.  However, I've never used it myself.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

```

## Alan, 2009-01-14 00:33

Subject: Re: How can I restrict git-diff to a specific set of directories?
Message-ID: <1231893196.31432.7.camel@rotwang.fnordora.org>
URL: https://gitlist.dev/e/1231893196.31432.7.camel%40rotwang.fnordora.org
In-Reply-To: <20090114000220.GB12624@atjola.homenet>

```
On Wed, 2009-01-14 at 01:02 +0100, Björn Steinbrink wrote:
> On 2009.01.13 15:49:03 -0800, Alan wrote:
> > I have a repository that I need to build a set of patches for a single
> > directory path.  (I just want the diffs on the one driver.)
> > 
> > Is there a clean non-hacky way to do this?
> > 
> > It is not cross repository or anything. I just need to generate a diff
> > between one commit and another, but only for the contents of a specific
> > directory.
> > 
> > I am not finding a real straightforward way to do that.  (Unless I am
> > missing something, which is quite possible.)
> 
> git diff commitA commitB -- some/paths/here some/more/here and/then/some
> 
> That limits the diff to the paths after the dashes.

Thanks! That is EXACTLY what I need.

```
