* Diff topic branch + working copy changes?
@ 2017-05-16 19:31 Robert Dailey
2017-05-17 2:47 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Robert Dailey @ 2017-05-16 19:31 UTC (permalink / raw)
To: Git
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? The reason I'm wanting to do this is because with difftool in
particular I like to make changes on the "right" side of each diff and
have those changes carry over to my working copy as edits I can
commit. This doesn't always work, especially if those same files are
already modified in my working copy but not committed.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Diff topic branch + working copy changes?
2017-05-16 19:31 Diff topic branch + working copy changes? Robert Dailey
@ 2017-05-17 2:47 ` Junio C Hamano
2017-05-17 13:39 ` Robert Dailey
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2017-05-17 2:47 UTC (permalink / raw)
To: Robert Dailey; +Cc: Git
Robert Dailey <rcdailey.lists@gmail.com> 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Diff topic branch + working copy changes?
2017-05-17 2:47 ` Junio C Hamano
@ 2017-05-17 13:39 ` Robert Dailey
2017-05-17 13:40 ` Robert Dailey
2017-05-17 21:17 ` Samuel Lijin
0 siblings, 2 replies; 5+ messages in thread
From: Robert Dailey @ 2017-05-17 13:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git
On Tue, May 16, 2017 at 9:47 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Robert Dailey <rcdailey.lists@gmail.com> 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!!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Diff topic branch + working copy changes?
2017-05-17 13:39 ` Robert Dailey
@ 2017-05-17 13:40 ` Robert Dailey
2017-05-17 21:17 ` Samuel Lijin
1 sibling, 0 replies; 5+ messages in thread
From: Robert Dailey @ 2017-05-17 13:40 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git
On Wed, May 17, 2017 at 8:39 AM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
> 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'.
Correction: settings like 'simple'
> 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!!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Diff topic branch + working copy changes?
2017-05-17 13:39 ` Robert Dailey
2017-05-17 13:40 ` Robert Dailey
@ 2017-05-17 21:17 ` Samuel Lijin
1 sibling, 0 replies; 5+ messages in thread
From: Samuel Lijin @ 2017-05-17 21:17 UTC (permalink / raw)
To: Robert Dailey; +Cc: Junio C Hamano, Git
On Wed, May 17, 2017 at 9:39 AM, Robert Dailey <rcdailey.lists@gmail.com> wrote:
>
> 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.
I think the spec would *just* be the working tree, if it ever got
implemented - I don't think it makes much sense to say "HEAD + working
copy".
Maybe something like this would do what you want?
# Diff Merge Base
dmb = "!f() { : git diff ; ref=$(git rev-parse --abbrev-ref HEAD); git
reset --soft $(git merge-base @{upstream} HEAD); git diff; git reset
--soft \"$ref\"; }; f"
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-05-17 21:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 19:31 Diff topic branch + working copy changes? Robert Dailey
2017-05-17 2:47 ` Junio C Hamano
2017-05-17 13:39 ` Robert Dailey
2017-05-17 13:40 ` Robert Dailey
2017-05-17 21:17 ` Samuel Lijin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.