public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Aaron Gray <aaronngray.lists@gmail•com>
Cc: Git Mailing List <git@vger•kernel.org>
Subject: Re: git diff --git-ignore
Date: Sun, 19 Sep 2021 19:23:38 -0700	[thread overview]
Message-ID: <xmqq4kagdlxx.fsf@gitster.g> (raw)
In-Reply-To: <CANkmNDf5KVn7Afj9xtvMGC0Ua7G6O3EOjBRtAfBOKOnaYgqVXA@mail.gmail.com> (Aaron Gray's message of "Mon, 20 Sep 2021 00:50:56 +0100")

Aaron Gray <aaronngray.lists@gmail•com> writes:

> Is it possible to add a --git-ignore flag to git diff so I only see
> the diffs for what I really want to be looking at, and not what I
> don't ;)

How does your --git-ignore option exactly guess differences for
which paths to show and which paths to exclude?  How do you tell the
"git diff --git-ignore" command which paths are what you really want
to be looking at?

If it is by magic, good luck writing such a feature ;-)

If it is like "I only am interested in changes in src/ directory and
the top-level Makefile", then perhaps using pathspec is what you
want.  E.g.

    $ git diff -- src/ Makefile
    $ git diff --cached -- src/ Makefile
    $ git diff master topic -- src/ Makefile
    $ git diff master...topic -- src/ Makefile

Modern Git even allows you to include negative elements to the
pathspec, e.g.

    $ git diff src/ ':(exclude)*.h'

would tell us "show only changes in the src/ directory, but do not
bother with changes to the dot-h files".

HTH

      reply	other threads:[~2021-09-20  2:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 23:50 git diff --git-ignore Aaron Gray
2021-09-20  2:23 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4kagdlxx.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=aaronngray.lists@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox