Inconsistancy with `git rebase --preserve-merges`

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.








[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux