Hey All,

I'm seeing some weird behavior when doing interactive rebase of a single 
commit with reword if there's a conflict. The rebased commit gets 
"squashed" into the target commit and is not a child of that.

>From here:

C
| B
|/
A

rebasing C on B should result in
C
|
B
|
A

but it will be
B+C
| B
|/
A

Here's what I'm doing:

> git --version
git version 2.18.0
> mkdir reword-test && cd reword-test
> git init
Initialized empty Git repository in /private/tmp/reword-test/.git/
> echo one > file && git add file && git commit -m 'init'
[master (root-commit) 150be96] init
 1 file changed, 1 insertion(+)
 create mode 100644 file
> echo two >> file && git commit -am 'two'
[master d89d85c] two
 1 file changed, 1 insertion(+)
> git tag two
> git reset --hard HEAD~
HEAD is now at 150be96 init
> echo three >> file && git commit -am 'three'
[master df276df] three
 1 file changed, 1 insertion(+)
> git log --oneline --graph two HEAD | cat
* df276df three
| * d89d85c two
|/
* 150be96 init
> git rebase -i two # change 'pick' to 'reword'
Auto-merging file
CONFLICT (content): Merge conflict in file
error: could not apply df276df... three

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase 
--abort".

You can amend the commit now, with

  git commit --amend

Once you are satisfied with your changes, run

  git rebase --continue
> cat file
one
<<<<<<< HEAD
two
=======
three
>>>>>>> df276df... three
> printf "one\ntwo\nthree\n" > file && git add file
> git status
interactive rebase in progress; onto d89d85c
Last command done (1 command done):
   reword df276df three
No commands remaining.
You are currently rebasing branch 'master' on 'd89d85c'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   file

> git rebase --continue # leaving commit msg as it is
[detached HEAD 261fae1] three
 Date: Fri Jul 13 15:28:33 2018 +0200
 1 file changed, 2 insertions(+)
Successfully rebased and updated refs/heads/master.
> git log --oneline --graph two HEAD | cat
* 261fae1 three
| * d89d85c two
|/
* 150be96 init

Can someone please explain what's going on here? My assumption was that 
after rebasing, HEAD will always be a descendant of the target commit, but 
this seems to be wrong in this case.

Kind Regards,
Daniel

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to