0

I have history in git like the following:

<hash2> commit2
<hash1> commit1
<hash0> initial commit

I do git rebase -i <hash0> and choose to edit (pick -> e) both commits (commit1 and commit2). After editing commit1 I try to commit changes by doing git commit --amend, I edit commit message and save it, git says 'Ok'.

Then I do git rebase --continue and now git's trying to merge commit2 into commit1, it says that there are some conflicts after applying commit2, so I edit this commit and save it, but when I do git commit --amend instead of writing changes as commit2 it merges them into commit1.

Maybe I missed something, why could this happen and how to fix that (I want my history of 3 commits to be the same after rebasing)?

1 Answer 1

1

Your interactive rebase workflow looks incorrect to me. Once you begin the interactive rebase via git rebase -i, Git will automatically pause when applying a commit if there would be any merge conflict. If that happens, you need only correct the conflicts, then type git rebase --continue to continue the rebase.

You normally should not be making explicit commits during an interactive rebase.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.