First of all, I just started to learn git.
I want to merge the red branch into the others, but there is no merge button.
In fact, essentially, I don't know why they are seperated.
git status
command.
If you are not on the branch you want to merge into (i.e. receiving branch), switch to that branch using git switch [branchname]
eg. git switch main
git merge [branchname]
eg. git merge featureA
I don't know why they are separated.
In your case, the red branch is orphan branch
, that's why it is separate.
In short, orphan branch doesn't share the same ancestor as other branches.
You can google for more detailed information.
To merge orphan branch, you should add --allow-unrelated-histories
flag to git merge
command.
eg. git merge featureA --allow-unrelated-histories
Above steps merge the branch named featureA
into main
branch.
Here is a good article by Atlassian if you want to learn more about merging.
Note:
before merging make sure all the changes are committed.
beware merge conflict may arise.
If you do not know how to solve merge conflicts, this article can help.