* How do I get a squashed diff for review
@ 2011-11-04 19:15 Alexander Usov
2011-11-05 9:15 ` David Aguilar
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Usov @ 2011-11-04 19:15 UTC (permalink / raw
To: git
Hi,
I'm wondering if there is an easy way to get a squashed diff of the
changes done on the feature branch for review.
In the simple cases (where feature branch is linear) there is an
absolutely fantastic way to get a patch for review:
git diff master...feature
However if the feature branch happened to be long-lived and had
mainline merged into it it's not going to work -- the
resulting diff would contain changes from the merge. The way we are
doing things now is to merge master into it
once more and then diff, however this is somewhat cumbersome. Is there
easier way to do it?
And while we are on the topic -- is there a tool for git similar to "bzr qdiff"?
It's a simple graphical diff viewer with 2 nice features -- it shows
complete diff (of multiple files) in a single window and
has a checkbox to switch between diff-only & full-text modes.
I have seen difftool, but it seems to work on per-file basis, and
something like "vi <(git diff ...)" lacks the easy way to
switch into full-text mode.
--
Best regards,
Alexander.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I get a squashed diff for review
2011-11-04 19:15 How do I get a squashed diff for review Alexander Usov
@ 2011-11-05 9:15 ` David Aguilar
2011-11-05 17:56 ` Alexander Usov
0 siblings, 1 reply; 5+ messages in thread
From: David Aguilar @ 2011-11-05 9:15 UTC (permalink / raw
To: Alexander Usov; +Cc: git, Roland Kaufmann
On Fri, Nov 04, 2011 at 07:15:01PM +0000, Alexander Usov wrote:
> Hi,
>
> I'm wondering if there is an easy way to get a squashed diff of the
> changes done on the feature branch for review.
> In the simple cases (where feature branch is linear) there is an
> absolutely fantastic way to get a patch for review:
> git diff master...feature
>
> However if the feature branch happened to be long-lived and had
> mainline merged into it it's not going to work -- the
> resulting diff would contain changes from the merge. The way we are
> doing things now is to merge master into it
> once more and then diff, however this is somewhat cumbersome. Is there
> easier way to do it?
"git diff A...B" is equivalent to "git diff <merge-base A B> B".
The merge-base can be found with "git merge-base A B"
and is simply the common ancestor of A and B.
Diffing against the merge base (which doesn't contain the merged
work done in master) is why you're seeing the merges in the diff.
It sounds like you want the simpler form of "diff" which doesn't
do any merge-base calculation.
e.g. "git diff A B" and its synonymn "git diff A..B".
> And while we are on the topic -- is there a tool for git similar to "bzr qdiff"?
> It's a simple graphical diff viewer with 2 nice features -- it shows
> complete diff (of multiple files) in a single window and
> has a checkbox to switch between diff-only & full-text modes.
> I have seen difftool, but it seems to work on per-file basis, and
> something like "vi <(git diff ...)" lacks the easy way to
> switch into full-text mode.
difftool is a wrapper around specialized diff tools, so the
ability to switch from diff to full view is tool-dependent.
A contrib "git-dirdiff" script was posted to the list recently.
It builds upon diff tools that can diff directory trees.
http://thread.gmane.org/gmane.comp.version-control.git/184528
There may be a newer version of this script, too. Roland would
know for sure...
--
David
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I get a squashed diff for review
2011-11-05 9:15 ` David Aguilar
@ 2011-11-05 17:56 ` Alexander Usov
2011-11-05 23:53 ` Junio C Hamano
0 siblings, 1 reply; 5+ messages in thread
From: Alexander Usov @ 2011-11-05 17:56 UTC (permalink / raw
To: David Aguilar; +Cc: git, Roland Kaufmann
On 5 November 2011 09:15, David Aguilar <davvid@gmail.com> wrote:
> On Fri, Nov 04, 2011 at 07:15:01PM +0000, Alexander Usov wrote:
>> Hi,
>>
>> However if the feature branch happened to be long-lived and had
>> mainline merged into it it's not going to work -- the
>> resulting diff would contain changes from the merge. The way we are
>> doing things now is to merge master into it
>> once more and then diff, however this is somewhat cumbersome. Is there
>> easier way to do it?
>
> "git diff A...B" is equivalent to "git diff <merge-base A B> B".
> The merge-base can be found with "git merge-base A B"
> and is simply the common ancestor of A and B.
>
> Diffing against the merge base (which doesn't contain the merged
> work done in master) is why you're seeing the merges in the diff.
>
> It sounds like you want the simpler form of "diff" which doesn't
> do any merge-base calculation.
>
> e.g. "git diff A B" and its synonymn "git diff A..B".
Just diffing 2 revisions (or trees) won't do the trick. Let me try to explain
what I'm trying to achieve.
Consider the following history:
master: A---B---D---F
\ \
branch: .-C--E--G
Now I want to review the changes made in the branch prior to merging it.
What I essentially want to be included in the diff are changes committed in
C & G and conflic resolution done in E (if any).
There are few ways that I know of to achieve it:
- use "git log -p branch ^master " to get a sequence of patches and try to
feed them into combinediff tool (part of the diffutils package). This
will require
some scripting and I'm not really sure if combinediff would work with
git patches.
- "git diff D..branch" would do a trick, but I'm not sure how to
correctly determine
D (if I'm to write a script). This would be the last (in topological
order) commit which is
reachable from both master & branch. Any suggestions on it?
>> And while we are on the topic -- is there a tool for git similar to "bzr qdiff"?
>> It's a simple graphical diff viewer with 2 nice features -- it shows
>> complete diff (of multiple files) in a single window and
>> has a checkbox to switch between diff-only & full-text modes.
>> I have seen difftool, but it seems to work on per-file basis, and
>> something like "vi <(git diff ...)" lacks the easy way to
>> switch into full-text mode.
>
> difftool is a wrapper around specialized diff tools, so the
> ability to switch from diff to full view is tool-dependent.
>
> A contrib "git-dirdiff" script was posted to the list recently.
> It builds upon diff tools that can diff directory trees.
>
> http://thread.gmane.org/gmane.comp.version-control.git/184528
>
> There may be a newer version of this script, too. Roland would
> know for sure...
Thanks. Will have a more carefull look at various tools & see if I can
figure something out.
--
Best regards,
Alexander.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I get a squashed diff for review
2011-11-05 17:56 ` Alexander Usov
@ 2011-11-05 23:53 ` Junio C Hamano
2011-11-06 2:33 ` Alexander Usov
0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-11-05 23:53 UTC (permalink / raw
To: Alexander Usov; +Cc: David Aguilar, git, Roland Kaufmann
Alexander Usov <a.s.usov@gmail.com> writes:
> Consider the following history:
>
> master: A---B---D---F
> \ \
> branch: .-C--E--G
>
> ...
> - "git diff D..branch" would do a trick, but I'm not sure how to
> correctly determine
> D (if I'm to write a script).
D is the merge-base between F and G. So "git diff $(git merge-base F G) G"
would compare D and G.
Modern git lets you write it as "git diff F...G" as this is a fairly
useful short-hand.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: How do I get a squashed diff for review
2011-11-05 23:53 ` Junio C Hamano
@ 2011-11-06 2:33 ` Alexander Usov
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Usov @ 2011-11-06 2:33 UTC (permalink / raw
To: Junio C Hamano; +Cc: David Aguilar, git, Roland Kaufmann
On 5 November 2011 23:53, Junio C Hamano <gitster@pobox.com> wrote:
> Alexander Usov <a.s.usov@gmail.com> writes:
>
>> Consider the following history:
>>
>> master: A---B---D---F
>> \ \
>> branch: .-C--E--G
>>
>> ...
>> - "git diff D..branch" would do a trick, but I'm not sure how to
>> correctly determine
>> D (if I'm to write a script).
>
> D is the merge-base between F and G. So "git diff $(git merge-base F G) G"
> would compare D and G.
>
> Modern git lets you write it as "git diff F...G" as this is a fairly
> useful short-hand.
Strange.
I definitely remember reading about "git diff F...G" and trying it out.
And somehow the result wasn't really correct -- as if commit B was
chosen to be merge-base.
I can't reproduce it right now on a sample repo -- will try it once
more back in the office.
Thanks for help.
--
Best regards,
Alexander.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-06 2:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-04 19:15 How do I get a squashed diff for review Alexander Usov
2011-11-05 9:15 ` David Aguilar
2011-11-05 17:56 ` Alexander Usov
2011-11-05 23:53 ` Junio C Hamano
2011-11-06 2:33 ` Alexander Usov
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).