# diff --diff-filter on modified but locally deleted files

3 messages from 2016-08-17 to 2016-08-17. Participants: Robert Dailey, Junio C Hamano.
Thread: https://gitlist.dev/t/43869

## Robert Dailey, 2016-08-17 18:04

Subject: diff --diff-filter on modified but locally deleted files
Message-ID: <CAHd499D50TLMYtAovTF80ev0=2u=9yyMNcq6-he3Ba2kXzqW9g@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499D50TLMYtAovTF80ev0%3D2u%3D9yyMNcq6-he3Ba2kXzqW9g%40mail.gmail.com

```
My use case is that I do a merge from branch A to branch B. Branch A
modified a file which is already deleted on B some time before the
merge.

When I do a `git status -sb`, these locally deleted but remotely
modified files show up as "DU".

I want to invoke git status or diff (or something else) to get a list
of these specific conflicts (locally deleted, remotely modified). I
tried this:

$ git diff --diff-filter=D --name-status

This gave me no results. I also tried adding --cached, didn't make a
difference. If I just do this:

$ git diff --name-status

This lists those files as just U instead of DU. So I'm not sure where
the "D" is coming from in this case.

Is there a way I can get a list of these specific conflicts? I'd like
to rely on working/index status for this if possible, since as I
resolve these conflicts I want the list to shorten and only show
unresolved conflicts of this type. Which rules out a diff range
between B...A that I could do.

```

## Junio C Hamano, 2016-08-17 18:34

Subject: Re: diff --diff-filter on modified but locally deleted files
Message-ID: <xmqq8tvv9rcd.fsf@gitster.mtv.corp.google.com>
URL: https://gitlist.dev/e/xmqq8tvv9rcd.fsf%40gitster.mtv.corp.google.com
In-Reply-To: <CAHd499D50TLMYtAovTF80ev0=2u=9yyMNcq6-he3Ba2kXzqW9g@mail.gmail.com>

```
Robert Dailey <rcdailey.lists@gmail.com> writes:

> My use case is that I do a merge from branch A to branch B. Branch A
> modified a file which is already deleted on B some time before the
> merge.
>
> When I do a `git status -sb`, these locally deleted but remotely
> modified files show up as "DU".
>
> I want to invoke git status or diff (or something else) to get a list
> of these specific conflicts (locally deleted, remotely modified).

As far as "git diff [--cached]" (which is "compare HEAD with the
working tree through index") is concerned, these paths are in the
"U"nmerged category, so you'd give "U" to diff-filter to view them.
Of course, that would give you other kinds of unmerged entries.

If you know they show up as DU, why not "grep DU" in that output?

```

## Robert Dailey, 2016-08-17 18:47

Subject: Re: diff --diff-filter on modified but locally deleted files
Message-ID: <CAHd499AP9VnQ8cVioc5aPQ7qUPdV=i70o58OW1Sh6uYOMf1W7Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAHd499AP9VnQ8cVioc5aPQ7qUPdV%3Di70o58OW1Sh6uYOMf1W7Q%40mail.gmail.com
In-Reply-To: <xmqq8tvv9rcd.fsf@gitster.mtv.corp.google.com>

```
On Wed, Aug 17, 2016 at 1:34 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Robert Dailey <rcdailey.lists@gmail.com> writes:
>
>> My use case is that I do a merge from branch A to branch B. Branch A
>> modified a file which is already deleted on B some time before the
>> merge.
>>
>> When I do a `git status -sb`, these locally deleted but remotely
>> modified files show up as "DU".
>>
>> I want to invoke git status or diff (or something else) to get a list
>> of these specific conflicts (locally deleted, remotely modified).
>
> As far as "git diff [--cached]" (which is "compare HEAD with the
> working tree through index") is concerned, these paths are in the
> "U"nmerged category, so you'd give "U" to diff-filter to view them.
> Of course, that would give you other kinds of unmerged entries.
>
> If you know they show up as DU, why not "grep DU" in that output?

I'm happy to do that and in fact considered it, but since
--diff-filter exists, I figured it might solve the problem. I also
need a better understanding of how diff-filter works since it
technically has 2 sides during a merge conflict. I guess it functions
only on the right (local) side.

Thanks Junio.

```
