threads / discuss / 64733

How is git diff --relative supposed to work?

Subject: How is git diff --relative supposed to work?

## tl;dr

2 messages between Jan 6, 2026 and Jan 6, 2026.

replies: 1people: 2as markdown or json

Johannes Sixt· Jan 6, 2026, 08:15 UTC · lore
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· Jan 6, 2026, 10:22 UTC · re: Johannes Sixt · lore

Re: How is git diff --relative supposed to work?

Johannes Sixt <j6t@kdbg.org> writes:
Show 8 quoted lines
> 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?

← back to recent threads