how to merge branch to master github - What is the best (and safest) way to merge a Git branch into master?

git merge origin/master into branch / git / git-branch / git-merge / branching-and-merging

A new branch from master is created, we call it test.

I would do git pull origin master from test.

git checkout test
git pull origin master
git push origin test
git checkout master
git pull origin test 
git checkout test
git pull origin master
git checkout master
git merge test

uneet7



Answer #1

Get Master and Branch up-to-date:

git checkout master
git pull --rebase origin master
git checkout <branch_name>
git pull --rebase origin <branch_name>

Merge Branch on top of Master:

git checkout <branch_name>
git rebase master

First, resolve conflict in file. Then:

git add .
git rebase --continue

Push your rebased Branch:

git push origin <branch_name>

Now you've got two options:

git checkout master
git merge --no-ff <branch_name>
git push origin master