Kevin Powell - CommunityKP-C
Kevin Powell - Community7mo ago
25 replies
Ganesh

help understanding conflict handling during git rebase

I am working out how to use git rebase. I created a repository and did these steps.

- I created index html and then commited it on main branch.
- I created a branch called modify and in it i added a blank line to index html and commited. I created index.css and commited that to the same branch.
- I created another branch called delete and deleted index.html then commited it.

now I want you guys to think that delete is my feature branch I am using to do something and modify is upstream that has been updated while I was working on delete.

I checkout the delete branch and do this command.

git rebase modify

to my understanding this will take the commits from modify then apply them on top of delete's commits? I get a merge conflict obviously because delete branch has deleted index.html while modify has modified it. I choose to do

git rm index.html git rebase --continue

to solve the confict. this makes it so my delete branch commit history looks like the screenshot below. The commit for deleting is above the commits from modify I am unsure of the details of this. I though the branch we are passing as argument to rebase will have it's commits on top because we're taking the unique commits from modify and putting em on delete branch(the commit hashes are new). unless the conflicted commits go last?
image.png
Was this page helpful?