git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* merge vs rebase: Is visualization in gitk the only problem?
@ 2007-10-27  7:17 Steffen Prohaska
  2007-10-27  8:16 ` David Symonds
  2007-10-27 20:59 ` Daniel Barkalow
  0 siblings, 2 replies; 5+ messages in thread
From: Steffen Prohaska @ 2007-10-27  7:17 UTC (permalink / raw)
  To: Git Mailing List

There are some discussions going on about merge vs. rebase. The
suggestions by Dscho is to prefer rebase over merge in a
CVS-style workflow.

Rebase has definitely benefits but not all of its details
are obvious at a first glance. Tell a newbie to read the
git rebase man page and explain what git reabase does and
you know what I mean. Rebase definitely can help to create a
cleaner history. But it rewrites history and therefore destroys
information, for example information about the original code
base a patch was developed against, or merge conflicts that
were resolved. You also need to decide when to use rebase and
when to use merge. So you need to make a choice.

Why not always use git merge?

Is the only problem of git merge that it might create loops
in the history with potentially long running parallel lines
that are insufficiently visualized in gitk?

If so, why not improve the visualization?

Or is there any other deficiency of always using merge and
never using rebase that I don't see?

Obviously you can use git merge only if you want to have _all_
changes from the other branch. But this is often what you
want. In a CVS-style workflow you want to merge all changes
from the shared branch before pushing. Why going through the
hassel of git rebase?

I'm aware that you can do other things with git rebase that
cannot be achieved by using git merge. For example moving a
topic branch to a different stable branch without merging all
of the topic branch's history ("--onto" option). It is easy
to explain that rebase has it's own value.

	Steffen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: merge vs rebase: Is visualization in gitk the only problem?
  2007-10-27  7:17 merge vs rebase: Is visualization in gitk the only problem? Steffen Prohaska
@ 2007-10-27  8:16 ` David Symonds
  2007-10-27  8:58   ` Steffen Prohaska
  2007-10-27 20:59 ` Daniel Barkalow
  1 sibling, 1 reply; 5+ messages in thread
From: David Symonds @ 2007-10-27  8:16 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: Git Mailing List

On 10/27/07, Steffen Prohaska <prohaska@zib.de> wrote:
>
> Rebase has definitely benefits but not all of its details
> are obvious at a first glance. Tell a newbie to read the
> git rebase man page and explain what git reabase does and
> you know what I mean. Rebase definitely can help to create a
> cleaner history. But it rewrites history and therefore destroys
> information, for example information about the original code
> base a patch was developed against, or merge conflicts that
> were resolved. You also need to decide when to use rebase and
> when to use merge. So you need to make a choice.
>
> Why not always use git merge?

I'd use git-rebase for when I'm sending stuff upstream that I don't
want to force the maintainer to merge, because I can probably do it
better and quicker by rebasing. Once that's done, the upstream
maintainer can just do a git-am (or similar), and it'll apply neatly
on top of the current head. In other words, git-rebase allows the
"merge effort" to be shifted to the brancher and away from the
mainline maintainer/developer.


Dave.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: merge vs rebase: Is visualization in gitk the only problem?
  2007-10-27  8:16 ` David Symonds
@ 2007-10-27  8:58   ` Steffen Prohaska
  2007-10-27 12:33     ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Steffen Prohaska @ 2007-10-27  8:58 UTC (permalink / raw)
  To: David Symonds; +Cc: Git Mailing List


On Oct 27, 2007, at 10:16 AM, David Symonds wrote:

> On 10/27/07, Steffen Prohaska <prohaska@zib.de> wrote:
>>
>> Rebase has definitely benefits but not all of its details
>> are obvious at a first glance. Tell a newbie to read the
>> git rebase man page and explain what git reabase does and
>> you know what I mean. Rebase definitely can help to create a
>> cleaner history. But it rewrites history and therefore destroys
>> information, for example information about the original code
>> base a patch was developed against, or merge conflicts that
>> were resolved. You also need to decide when to use rebase and
>> when to use merge. So you need to make a choice.
>>
>> Why not always use git merge?
>
> I'd use git-rebase for when I'm sending stuff upstream that I don't
> want to force the maintainer to merge, because I can probably do it
> better and quicker by rebasing. Once that's done, the upstream
> maintainer can just do a git-am (or similar), and it'll apply neatly
> on top of the current head. In other words, git-rebase allows the
> "merge effort" to be shifted to the brancher and away from the
> mainline maintainer/developer.

That definitely makes sense.

But you may need to do more merging because you need to merge every
single commit. It may be easier to merge only the final state of
a topic branch.

Could we somehow send rerere information together with a
patch? This would give the upstream maintainer (and everyone
else who wants to test the patch) the help needed to do a merge.

	Steffen

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: merge vs rebase: Is visualization in gitk the only problem?
  2007-10-27  8:58   ` Steffen Prohaska
@ 2007-10-27 12:33     ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2007-10-27 12:33 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: David Symonds, Git Mailing List

Hi,

On Sat, 27 Oct 2007, Steffen Prohaska wrote:

> Could we somehow send rerere information together with a patch? This 
> would give the upstream maintainer (and everyone else who wants to test 
> the patch) the help needed to do a merge.

IMHO this is not sensible to send over email.  But think I that something 
like this could be done for pullers: they fetch from somewhere, and then 
recreate the rerere information from the merge commits they just got (this 
would have to be a new option to git-rerere, methinks).

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: merge vs rebase: Is visualization in gitk the only problem?
  2007-10-27  7:17 merge vs rebase: Is visualization in gitk the only problem? Steffen Prohaska
  2007-10-27  8:16 ` David Symonds
@ 2007-10-27 20:59 ` Daniel Barkalow
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Barkalow @ 2007-10-27 20:59 UTC (permalink / raw)
  To: Steffen Prohaska; +Cc: Git Mailing List

On Sat, 27 Oct 2007, Steffen Prohaska wrote:

> There are some discussions going on about merge vs. rebase. The
> suggestions by Dscho is to prefer rebase over merge in a
> CVS-style workflow.
> 
> Rebase has definitely benefits but not all of its details
> are obvious at a first glance. Tell a newbie to read the
> git rebase man page and explain what git reabase does and
> you know what I mean. Rebase definitely can help to create a
> cleaner history. But it rewrites history and therefore destroys
> information, for example information about the original code
> base a patch was developed against, or merge conflicts that
> were resolved. You also need to decide when to use rebase and
> when to use merge. So you need to make a choice.
> 
> Why not always use git merge?
> 
> Is the only problem of git merge that it might create loops
> in the history with potentially long running parallel lines
> that are insufficiently visualized in gitk?
>
> If so, why not improve the visualization?
> 
> Or is there any other deficiency of always using merge and
> never using rebase that I don't see?

Not all possible upstream systems support non-linear history. If upstream 
is actually svn or cvs, you need to rebase in order for the other system 
to be able to represent the result.

I think it's easier for someone from the future trying to figure out the 
historical reason for some code to be a certain way if that code isn't 
touched by a merge conflict resolution. If there is a conflict, the 
resulting content is most directly due to a commit that has no explanation 
aside from a note that there was a conflict there; it's somewhat easier to 
understand if the code is entirely attributable to the commit that 
logically introduces the change. (Although maybe we could make the display 
take care of this; linearize the history using the rerere info in the 
merge commit, and show that as the history, annotated suitably to indicate 
that the blame for some of it falls partially on the merge commit.)

It's also more familiar for many users to be asked to place their changes 
after all other committed changes, rather than leaving the ancestry pegged 
at the last time they updated before starting to work.

> Obviously you can use git merge only if you want to have _all_
> changes from the other branch. But this is often what you
> want. In a CVS-style workflow you want to merge all changes
> from the shared branch before pushing. Why going through the
> hassel of git rebase?

Unless you've got a series of changes to a section that the upstream also 
changed, it's the same amount of resolution, but rebase lets you resolve 
logical collections of conflicts (i.e., those due to a single one of your 
commits) individually. IIRC, merging my builtin-fetch topic after 1.5.3 
had 3 scattered conflicts, and rebasing had 4 conflicts, with no more than 
one per commit (so that I could test the resolutions independantly), and 
the rebase was easier.

	-Daniel
*This .sig left intentionally blank*

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-10-27 20:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-27  7:17 merge vs rebase: Is visualization in gitk the only problem? Steffen Prohaska
2007-10-27  8:16 ` David Symonds
2007-10-27  8:58   ` Steffen Prohaska
2007-10-27 12:33     ` Johannes Schindelin
2007-10-27 20:59 ` Daniel Barkalow

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).