rebase - "fixup!" conflict applied at the wrong code location, why ?
- From
Philippe Blain <levraiphilippeblain@gmail.com>
- Date
- Jul 8, 2020, 23:03 UTC
- Message-ID
- <7A30EA48-72E3-47E1-9792-136D7B96DC84@gmail.com>
Hello,
I've been working on a branch for a while. I've been using `git commit --fixup` and `git commit --squash` when I noticed that I had forgotten to add something to a previous commit. Today I did `git rebase --autosquash` to clean up my history, and the rebase failed at the first 'fixup!' commit with a conflict. However, the conflict is not located at the right place in the code (it's not in the right subroutine!). This is very surprising to me, and I would like to understand why it happens.
Steps to reproduce:
git clone -b branch-to-be-rebased https://github.com/phil-blain/CICE.git cice cd cice git rebase -i --autosquash my-first-commit # save the todo list without modifications Auto-merging <file> CONFLICT (content): Merge conflict in <file> error: could not apply e8bfa55... fixup! <commit message of f4e1ae6> # the rebase stops at f4e1ae6 git diff # tangential question : for some reason the hunk header does not appear here, I don't know why... git diff -2 # but it appears here git grep -p -e '<<<<<<< HEAD' -e '>>>>>>> e8bfa55...' # or here # ok, the conflict appears in subroutine 'picard_solver' git show REBASE_HEAD -U5 # but the original "fixup!" commit only modifies the subroutine 'anderson_solver' !!
I would have expected that the conflict be created around lines 1118-1132 (line numbers in f4e1ae6), in the 'anderson_solver' subroutine.
I don't know if this plays a part here, but commit f4e1ae6 (where the rebase stops) is the commit where the 'anderson_solver' subroutine is added to the code...
Thanks,
Philippe.