Re: git pull suggestion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff King <peff@xxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]