merge one local branch into another local branch
To merge one branch into another, such as merging "feature_x" branch into "master"* branch:
git checkout master
git merge feature_x
* Note that the original branch name is now commonly main
instead of master
. Choose the correct name based on your situation.
This page is the first result for several search engines when looking for "git merge one branch into another". However, the original question is more specific and special case than the title would suggest.
It is also more complex than both the subject and the search expression. As such, this is a minimal but explanatory answer for the benefit of most visitors.
First, checkout to your Branch3:
git checkout Branch3
Then merge the Branch1:
git merge Branch1
And if you want the updated commits of Branch1 on Branch2, you are probaly looking for git rebase
git checkout Branch2
git rebase Branch1
This will update your Branch2 with the latest updates of Branch1.
git checkout [branchYouWantToReceiveBranch] //checkout branch to receive branch
git merge [branchYouWantToMergeIntoBranch]