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 seperated.
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 the following flag --allow-unrelated-histories
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 if you want to learn more about merging.
Note:
A. before merging make sure all the changes are committed.
B. beware Merge conflict may arise. In that case this article might help