Simple and easy to understand git merge branches
Suppose we are on the test branch and have just completed a function and executed the following command:
git add .
git commit -m 'test分支提交的备注信息'
git push origin dev
After testing, the newly developed functions on the test branch are no longer problematic. If you want to merge the test branch into the master branch, the operation is as follows:
- First switch to the master branch
git checkout master
- If it is developed by multiple people, you need to pull the code on the remote master
git pull origin master
- Then we merge the code of the test branch to master
git merge dev
- Then check the status and execute the submit command
git status
On branch master
Your branch is ahead of 'origin/master' by 12 commits.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
The above means that you have 12 commits and need to be pushed to the remote master
- Finally execute the following submit command
git push origin master