Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git merge two local branches

Tags:

git

merge

I have branch Master, branchA and branchB. Now I'm working in the branchA and I need to merge branchA with branchB and proceed my work in the branchA. All files are comitted in the branchA and branchB.

What's the fast way to implement it?

like image 784
user3127896 Avatar asked Oct 04 '22 00:10

user3127896


People also ask

Can I merge two local branches?

To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.

Can we merge two branches in git?

Git merge will combine multiple sequences of commits into one unified history. In the most frequent use cases, git merge is used to combine two branches.

How do I merge locally?

To do a merge (locally), git checkout the branch you want to merge INTO. Then type git merge <branch> where <branch> is the branch you want to merge FROM. Because the history of master and the history of make_function share common ancestors and don't have any divergence descendents, we get a "fast-forward" merge.


1 Answers

If I understood your question, you want to merge branchB into branchA. To do so,

first checkout branchA like below,

git checkout branchA

Then execute the below command to merge branchB into branchA:

git merge branchB
like image 463
Abimaran Kugathasan Avatar answered Oct 12 '22 04:10

Abimaran Kugathasan