Re: Diff topic branch + working copy changes?

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

 



On Tue, May 16, 2017 at 9:47 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Robert Dailey <rcdailey.lists@xxxxxxxxx> writes:
>
>> So for a topic branch based on master, I can diff ONLY my changes on
>> the topic branch by doing this simple command:
>>
>> $ git diff origin/master...
>>
>> However, this does not include uncommitted working copy changes. To
>> work around this, I can do this instead:
>>
>> $ git diff origin/master
>>
>> (No three-dot notation above)
>>
>> However this implies a ".." notation which will include changes on
>> master that have been made after I branched my topic (I use three-dot
>> to exclude those).
>>
>> Is there a way I can do the first diff but also include working copy
>> changes?
>
> I've wished this a few times, but the answer is no.  Not as a
> short-hand like "..." anyway.
>
> You can still do
>
>     $ git diff $(git merge-base origin/master HEAD)
>
> of course.

Thanks Junio, I forgot about merge-base. I'll create some aliases for now:

    # Diff Branch
    db = "!f() { : git diff ; git diff $(git merge-base @{upstream}
HEAD) ; }; f"

    # Diff Tool Branch
    dtb = "!f() { : git diff ; git difftool -d $(git merge-base
@{upstream} HEAD) ; }; f"

Since I use push.default = current, I always keep my upstream set to
the parent branch (origin/master, origin/release/1.2.3, etc). So in my
case these aliases work, but probably not for other push.default
settings like 'upstream'.

Would be nice in the future to have another revision specification
like @{wc} for "HEAD + working copy". I guess this technically isn't a
revision, but something along those lines. Or maybe just an
--include-wc for diff or something.

Thanks again!!



[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]