The question was: Do you need to run a normal or interactive rebase?
When you're in doubt you can always use the
interactive option. But it's only required when you want to manually edit the commit history in some way.
So let's have a look at our commit history.
Quick look at the commit history
To get a clear picture of what we want to achieve let's have another look at a visualization of the current commit history. You can confirm this on your local machine using the
git log command.
We would like to rearrange the commits slightly to get this image.
Do you think we need the interactive rebase or not?
As you can see above we don't need to remove any commits. We just want to rearrange them so that the commits from
main appear before the commit from the
That's what rebase does by default. Thus we can use a simple rebase without the interactive option.
Go ahead and rebase the
bottom-section branch on top of the
If everything went as planned... you see an error!
A merge conflict
This looks scary! At least that's what I thought the first times I encountered merge conflicts.
But it doesn't have to be. Let's take a deep breath and read the output line by line.
The first line seems fine. But then it says
CONFLICT (content): Merge conflict in src/styles.css.
And there's a second line which is similar:
CONFLICT (content): Merge conflict in src/index.html.
Another important piece of information is this line:
error: could not apply 625e99d... Add bottom section.
What does this all mean?
Being able to read and understand error messages is one of the most important skills of a software developer. So let's try to understand what this means.
The output says that there was a problem when applying the commit
Add bottom section. Remember that Git first takes all the commits from the
main branch and adds each commit of the
bottom-section branch one after another. Basically, Git didn't know how to do that.
The reasons are the files
src/index.html as mentioned in the first two lines. But we don't know yet what exactly the problem is.
We'll find out soon.
Next: Resolving the Conflicts