Skip to content

Make git diff .. less confusing for newbies #249

Closed

Description

@Denton-L

It's pretty ridiculous how the meaning of .. and ... is exactly swapped for log and diff: log A..B is changes from merge base to B which is what diff A...B does

-phiresky link

The semantics of .. vs ... are essentially swapped between diff and the log family of commands. This is because diff uses setup_revisions but abuses the way that the returned endpoints are used.

There are several options to deal with this:

  • Print a warning into the output if a user uses git diff A..B instead of git diff A B (see here)

  • Update the documentation for git-diff so that it's obvious why this is happening (so we tell users about how range-notation is implemented). Upside is users will understand why git diff foo@^! works as well. Downside is that I'm not sure it's productive to expose implementation details to end-uers.

  • Swap the meaning of .. and .... One can dream...

  • Something else? I've been mulling over it and not wanting to contribute a patch because there might be some cleaner way to resolve this. Not really sure how.

See:

Activity

  1. Denton-L commented on Nov 2, 2020

    @Denton-L
    MemberAuthor

    Well, .. has been deprecated in the docs. And users can avoid using range-notation entirely via the --merge-base flag now: b6fb70c. I'll declare this one closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions