On Fri, 18 Oct 2019 at 11:59, Benjamin <wangchao.nlp....@gmail.com> wrote:

> This could be an issue of git. The exact steps to reproduce this issue are
> as below,
>
>     $git merge master
> ...
>    $git rebase -i e705c6a dev1  # e705c6a is the ancestor commit of
> branch dev1
>    In the interactive rebase page, Keep using "pick" for the first commit,
> and use "s" for all other commits.
> 5. You will find that the changes made in step 3 are lost.
>

I'd suggest doing `git help rebase` and reading about `--preserve-merges`
and section "BUGS". Short quotation:

       -p, --preserve-merges
>            Recreate merge commits instead of flattening the history by
>            replaying commits a merge commit introduces. Merge conflict
>            resolutions or manual amendments to merge commits are not
>            preserved.
>            This uses the --interactive machinery internally, but combining
> it
>            with the --interactive option explicitly is generally not a good
>            idea unless you know what you are doing (see BUGS below).


and


> BUGS
>        The todo list presented by --preserve-merges --interactive does not
>        represent the topology of the revision graph. Editing commits and
>        rewording their commit messages should work fine, but attempts to
>        reorder commits tend to produce counterintuitive results.


In short, doing interactive rebase with merges is always a bit hard. Trying
to combine that with squash is asking for trouble.

If you really want to do the merge and squash combined, I think you can
start with your current final code with "incorrect" history, do a `git
reset --soft $MERGESHA1` and then `git commit --amend`. If you already lost
the "final code", `git reflog` will be your friend.

-- 
Mikko

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/CAM2wTFbUi2k7Z87g4nvi7tgJYvsKELw45ocHrpnwUxSLxrEbaw%40mail.gmail.com.

Reply via email to