# How is git diff --relative supposed to work?

2 messages from 2026-01-06 to 2026-01-06. Participants: Johannes Sixt, Junio C Hamano.
Thread: https://gitlist.dev/t/64733

## Johannes Sixt, 2026-01-06 08:15

Subject: How is git diff --relative supposed to work?
Message-ID: <f1cd3ca7-9b31-45b0-b990-05f4d1f6b4f2@kdbg.org>
URL: https://gitlist.dev/e/f1cd3ca7-9b31-45b0-b990-05f4d1f6b4f2%40kdbg.org

```
Try this in your favorite repository:

$ echo foo >> Makefile
$ git -P diff --name-only --relative=Ma
kefile

This doesn't look right. Shouldn't the path specified with --relative be
interpreted as a directory instead of an arbitrary textual prefix?

-- Hannes


```

## Junio C Hamano, 2026-01-06 10:22

Subject: Re: How is git diff --relative supposed to work?
Message-ID: <xmqqfr8jjb1g.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqfr8jjb1g.fsf%40gitster.g
In-Reply-To: <f1cd3ca7-9b31-45b0-b990-05f4d1f6b4f2@kdbg.org>

```
Johannes Sixt <j6t@kdbg.org> writes:

> Try this in your favorite repository:
>
> $ echo foo >> Makefile
> $ git -P diff --name-only --relative=Ma
> kefile
>
> This doesn't look right. Shouldn't the path specified with --relative be
> interpreted as a directory instead of an arbitrary textual prefix?

Sounds like an utter nonsense to me, too.  If we assume Ma were a
directory, would the result be "../Makefile" relative to the Ma
directory?


```
