git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kevin Daudt <me@ikke.info>
To: Robin Moussu <moussu.robin@pm.me>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: Inconsistancy with `git rebase --preserve-merges`
Date: Mon, 24 Feb 2020 19:36:48 +0100	[thread overview]
Message-ID: <20200224183648.GF1247035@alpha> (raw)
In-Reply-To: <tmm3ViXf1QO5dCCNgDCHCHSZeUKUfiYvNoI9RMvdLlnOLk0oUt_w2SKgYu3LPh6no-wHhq1gXbVlBKgLcnGCR5HaTgWMx5se9KmJOKITUHk=@pm.me>

On Mon, Feb 24, 2020 at 02:10:07PM +0000, Robin Moussu wrote:
> Hi. I noticed that the position of the `--preserve-merges` option of
> `git rebase` is significant (I think it shouldn't).
> 
> The following snippet doesn't preserve the merges:
> ```
> $ git rebase --preserve-merges -i 412f07a~
> pick 412f07a Work on dev branch
> pick c6efccd Work on master branch
> pick 71c8c37 Some work after the merge
> ```
> 
> Whereas this one does what I expect:
> ```
> $ git rebase -i 412f07a~ --preserve-merges
> pick 412f07a Work on dev branch
> pick 616064c Merge branch 'master' into dev
> pick 71c8c37 Some work after the merge
> ```
> 
> For reference:
> ```
> $ git log --graph --oneline
> * 71c8c37      (HEAD -> dev) Some work after the merge
> *   616064c    Merge branch 'master' into dev
> |\
> | *   c6efccd  Work on master branch
> | *   ... (more work on master)
> * |   412f07a  Work on dev branch
> * |   ... (more work on dev)
> |/
> * 4ee50cb Common ancestor
> ```
> 
> Step to reproduce:
> ```
> mkdir temp
> cd temp
> git init
> git commit --allow-empty -m 'Common ancestor'
> git checkout -b dev
> git commit --allow-empty -m 'Work on dev branch'
> git tag some_commit
> git checkout master
> git commit --allow-empty -m 'Work on master branch'
> git checkout dev
> git merge master -m 'Merge branch 'master' into dev'
> git commit --allow-empty -m 'Some work after the merge'
> ```
> Then you will see that
>     git rebase -i some_commit --preserve-merges
> and
>     git rebase --preserve-merges  -i some_commit
> don't have the same output.
> 
> I am using git version 2.21.1 on Fedora 30.
> 
> Robin.
> 

Can you try `--rebase-merges` instead? Since v2.22.0 `--preseve-merges`
is officially deprecated, but even before that it was already known to
have flaws.

Kevin

  reply	other threads:[~2020-02-24 18:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <v9k9hyJjfgQYYIczd9NqrjSdyOyxwqEB0iWyQ_TZCnobCZZoZ8_v6WB4KcWyW5xxRPdDUyEqEYfXylOnGI57CtK9KegMgp_0bz_5RrIIhHY=@pm.me>
2020-02-24 14:10 ` Inconsistancy with `git rebase --preserve-merges` Robin Moussu
2020-02-24 18:36   ` Kevin Daudt [this message]
2020-02-24 21:35     ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20200224183648.GF1247035@alpha \
    --to=me@ikke.info \
    --cc=git@vger.kernel.org \
    --cc=moussu.robin@pm.me \
    /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 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).