git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aghiles <aghilesk@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Nicolas Sebrecht <nicolas.s.dev@gmx.fr>,
	Thomas Rast <trast@student.ethz.ch>,
	git list <git@vger.kernel.org>
Subject: Re: git pull suggestion
Date: Fri, 9 Apr 2010 16:54:41 -0400	[thread overview]
Message-ID: <h2m3abd05a91004091354t1b1de4aag48816d7e47cc766@mail.gmail.com> (raw)
In-Reply-To: <20100409034911.GA4020@coredump.intra.peff.net>

Jeff King <peff@peff.net> wrote:
> It is possible to manually get the answer you want, or close to it. You
> are looking for the intersection of files modified by you and files
> modified by the upstream. So:
>
>  # unique list of modified working tree files and index entries
>  $ (git diff-files --name-only;
>     git diff-index --name-only HEAD
>    ) | sort -u >us
>  # files that will be changing as part of merge
>  $ git diff-tree --name-only $HEAD_TO_MERGE_FROM | sort >them
>  $ comm -12 us them
>
> where $HEAD_TO_MERGE_FROM in my example would be "other", but in the
> case of a pull, would probably be FETCH_HEAD.

It works. You actually need the -r flag to 'git diff-tree' (recursive) in order
to list the actual files and not only their parent directories. So it becomes:

$ (git diff-files --name-only; git diff-index --name-only HEAD ) | sort -u>us
$ git diff-tree -r --name-only $HEAD_TO_MERGE_FROM | sort > them
$ comm -12 us them

Thank you very much,

  -- aghiles

      parent reply	other threads:[~2010-04-09 20:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 23:17 git pull suggestion Aghiles
2010-04-08 15:54 ` Thomas Rast
2010-04-08 19:33   ` Aghiles
2010-04-08 23:11     ` Nicolas Sebrecht
2010-04-09  3:06       ` Aghiles
2010-04-09  3:49         ` Jeff King
2010-04-09 19:33           ` Aghiles
2010-04-10  4:35             ` Jeff King
2010-04-10  4:40               ` Junio C Hamano
2010-04-11  6:01               ` Aghiles
2010-04-11  7:37                 ` Junio C Hamano
2010-04-11 16:33                   ` Matthieu Moy
2010-04-12 20:18                   ` Aghiles
2010-04-12 21:35                     ` Junio C Hamano
2010-04-09 20:54           ` Aghiles [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=h2m3abd05a91004091354t1b1de4aag48816d7e47cc766@mail.gmail.com \
    --to=aghilesk@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=nicolas.s.dev@gmx.fr \
    --cc=peff@peff.net \
    --cc=trast@student.ethz.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).