all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Engster <deng@randomsample.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: master c6f03ed: Fix a problem in url.el without GnuTLS
Date: Wed, 17 Dec 2014 21:37:06 +0100	[thread overview]
Message-ID: <87egrynhcd.fsf@engster.org> (raw)
In-Reply-To: <83lhm7wfd4.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 16 Dec 2014 21:42:47 +0200")

Eli Zaretskii <eliz@gnu.org> writes:
>> From: David Engster <deng@randomsample.de>
>> Cc: emacs-devel@gnu.org
>> Date: Mon, 15 Dec 2014 21:39:58 +0100
>> 
>> >     when I work on a feature branch that takes weeks, sometimes
>> > months, to complete, I merge from master near the end of the
>> > development, to make sure landing the feature will not introduce
>> > regressions.  Sometimes there's more than one such merge, especially
>> > if I discover subtle issues as result of merging.
>
>> I see. I guess you could avoid those problems by merging origin/master
>> instead.
>
> Sorry, I don't understand: doesn't origin/master have the same commits
> as master (modulo the local commits I did on master since the last
> pull)?  If so, how would merging origin/master help me?
>
> Once again, the problem is in this situation:
>
>  . My work on a feature branch is almost finished, so I merge from
>    master to make sure my feature doesn't break anything and isn't
>    broken by development on master.
>
>  . I then merge from the feature branch to master and attempt to push,
>    but the push is rejected.
>
>  . I then pull --rebase=preserve and push again
>
> It's the last step that causes trouble, and the "trouble" here is that
> commits I merged from master before merging back might be merged again
> in the future, if I need for some reason to continue working on that
> feature branch again.

Thank you for explaining it again. You are right that 'origin/master'
won't help you in this case. As soon as you rebase, merge and push, you
simply cannot work on your old branch. You have to delete it and set it
up anew. If HEAD is your merge commit, this would mean doing

  git branch -D branchname
  git branch branchname HEAD^2

(You have to delete with '-D', since Git won't see your non-rebased
branch as merged...). This is why I prefer an explicit rebase onto
master, as it will not keep the old one lying around.

>> But actually, instead of merging master into your feature
>> branch, I'd rather recommend rebasing it *onto* master, but explicitly
>
> That'd lose too much information, so I'd like to avoid that if
> possible.

What kind of information do you mean here? I'm guessing you want to see
the merges from master and how you reacted to them? You're right that
this will be lost.

>> - If the push fails because there are new commits upstream, instead of
>>   using 'pull --rebase=preserve', I rather delete the merge so that I
>>   get a "normal" fast-forward pull and merge again. If I'm really
>>   unlucky, this new commit from upstream causes a conflict now, in which
>>   case I usually just resolve it, simply hoping that the push will work
>>   next time.
>
> If "merge --no-ff" and aborting the merge when a push is rejected are
> to be used anyway, why do I need to rebase the feature branch onto
> master?  That doesn't seem necessary.  I could use normal merges, no?

Yes. I do that instead of merging master into my feature branch. I just
happen to not like this "merge from trunk" business, and I also prefer
to resolve conflicts commit-by-commit. Also, I usually do an interactive
rebase to clean up my branch before merging (I usually never get a
feature branch "right" the first time).

>> look like they were made on another branch, but if I understand you
>> correctly now, you mean you don't want to have merge commits from master
>> before pushing, but you rather prefer to rebase (to which I agree as
>> well).
>
> I actually don't mind merge commits, as long as they reflect what was
> actually done, as opposed to being generated by Git out of thin air.
>
> What I certainly want to avoid is any kind of rebasing, cherry-picking
> or similar things that will then put me at risk of having the same
> commits merged again, because the original commits are rewritten or
> not recorded in the DAG.

OK, let me try to summarize what I think are the two main conflicting
requirements:

. You want to handle merges of local feature branches and public
  branches (like 'emacs-24') in the same way.

I think this one is the strongest requirement, since it means you simply
cannot use 'rebase' in any way. Also, you've pointed out several other
problems with 'rebase', like loosing the "real" history of a feature
branch, and accidental merging of rebased commits.

Therefore, I think a purely merge-based workflow is really the only
option for you, which however brings us to

. You want to keep a clear history of 'mainline', meaning you want to
  achieve a similar log view to that from Bazaar, using 'git log
  --first-parent'.

This conflicts with how Git orders the parents of a merge. The first
parent is always the tip of the branch you're currently on. And since
you do 'git pull' while being on your local master, that will be the
first parent. 

I happen to dislike that about Git as well, but I agree with Stefan that
this is not something we should worry about. Probably the easiest way
without resorting to rebase you've already said yourself: delete the
merge, do a fast-forward pull, merge again.

An alternative would be to swap the parents after the merge of a normal
'git pull', but that requires some Git plumbing, which however can be
easily scripted.

Of course, while *you* can take care in keeping the correct ordering of
mainline, others won't do that (I guess most are not even aware of this
issue), so I'm afraid you will be greeted with git's usual spaghetti
history soon enough. One could implement a git hook that checks for a
linear git history of mainline and that rejects pushes otherwise, but I
guess Stefan isn't very inclined to agree to that.

-David



  parent reply	other threads:[~2014-12-17 20:37 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141211155740.11916.1584@vcs.savannah.gnu.org>
     [not found] ` <E1Xz67Y-00036o-Vf@vcs.savannah.gnu.org>
2014-12-11 16:47   ` master c6f03ed: Fix a problem in url.el without GnuTLS Leo Liu
2014-12-11 18:08     ` Eli Zaretskii
2014-12-11 23:00       ` Ted Zlatanov
2014-12-12  9:23         ` Eli Zaretskii
2014-12-12 13:24           ` Ted Zlatanov
2014-12-12 14:28             ` Eli Zaretskii
2014-12-12 16:06               ` Stefan Monnier
2014-12-13  0:25               ` Ted Zlatanov
2014-12-13  0:28                 ` Lars Magne Ingebrigtsen
2014-12-13  1:25                 ` Ted Zlatanov
2014-12-13  8:04                 ` Eli Zaretskii
2014-12-13 10:16                   ` David Engster
2014-12-18 22:38                     ` David Engster
2014-12-19  8:50                       ` Eli Zaretskii
2014-12-13  9:04                 ` David Engster
2014-12-13  9:50                   ` David Engster
2014-12-13 13:19                     ` Ted Zlatanov
2014-12-13 14:13                       ` David Engster
2014-12-13 14:25                         ` Ted Zlatanov
2014-12-13 15:18                         ` Eli Zaretskii
2014-12-13 19:44                           ` David Engster
2014-12-13 19:59                             ` Eli Zaretskii
2014-12-13 22:00                               ` Dmitry Gutov
2014-12-14  3:36                                 ` Eli Zaretskii
2014-12-13 23:13                               ` David Engster
2014-12-14 16:09                                 ` Eli Zaretskii
2014-12-14 16:37                                   ` Ted Zlatanov
2014-12-14 16:55                                     ` Eli Zaretskii
2014-12-14 17:00                                       ` Ted Zlatanov
2014-12-14 23:21                                     ` Stefan Monnier
2014-12-14 17:46                                   ` Paul Eggert
2014-12-14 17:50                                     ` Eli Zaretskii
2014-12-14 18:28                                     ` Ted Zlatanov
2014-12-14 19:41                                       ` David Engster
2014-12-14 21:40                                   ` David Engster
2014-12-15  3:47                                     ` Eli Zaretskii
2014-12-15 20:39                                       ` David Engster
2014-12-16 19:42                                         ` Eli Zaretskii
2014-12-17  9:58                                           ` Steinar Bang
2014-12-17 10:52                                             ` Steinar Bang
2014-12-17 15:36                                               ` Eli Zaretskii
2014-12-17 15:35                                             ` Eli Zaretskii
2014-12-17 20:37                                           ` David Engster [this message]
2014-12-18  4:55                                             ` Stephen J. Turnbull
2014-12-18 15:39                                               ` Eli Zaretskii
2014-12-18 20:00                                                 ` Steinar Bang
2014-12-18 20:40                                                   ` Eli Zaretskii
2014-12-19  8:09                                                     ` Steinar Bang
2014-12-19  9:16                                                       ` Eli Zaretskii
2014-12-19 10:33                                                         ` Steinar Bang
2014-12-18 21:18                                               ` David Engster
2014-12-18 15:38                                             ` Eli Zaretskii
2014-12-18 19:46                                               ` Steinar Bang
2014-12-18 20:35                                                 ` Eli Zaretskii
2014-12-19  6:07                                                   ` Yuri Khan
2014-12-19  7:57                                                     ` Steinar Bang
2014-12-19  9:09                                                     ` Eli Zaretskii
2014-12-18 20:46                                               ` David Engster
2014-12-14 22:42                                   ` Stefan Monnier
2014-12-15  3:37                                     ` Eli Zaretskii
2014-12-15  4:46                                       ` Stefan Monnier
2014-12-12 20:46             ` Lars Magne Ingebrigtsen
2014-12-12  0:30       ` Leo Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87egrynhcd.fsf@engster.org \
    --to=deng@randomsample.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.