Question:

There are two branches, master and develop.
What is the best and safest way merge develop branch into master branch?

Answer:

Here is the solution. After you commit everything in develop branch.

Do as following steps:

1
2
3
4
git checkout master
git pull origin master
git merge develop
git push origin master

As other answers mentioned, this solution is only acceptable for a small project, like only few branches, and other people won’t make changes in master branch. From my personal perspective, if there are some conflicts between master and develop branch, this might not be a good way to solve this problem.

Reference

Best (and safest) way to merge a git branch into master


This is the end of post