This article mainly introduces the detailed process steps of Git merge branch. The article introduces the sample code in great detail, which has a certain reference value for everyone's study or work. Friends who need it, let's learn together with the editor. |
The process of merging branch dev to master normally:
(Merging to other branches is similar to Ha)
1. The dev branch to be merged first updates and submits all files
Note: If you do not need to submit the localized modification file, it is best not to submit it. Temporary backup and then delete or withdraw.
Enter the project root directory, and then execute:
git add . git commit -m'Submit files of all dev branches' git push -u origin dev
2. Switch to the master branch
git checkout master
3. Update the master code to the latest
git pull origin master
4. Merge the code of the dev (the base branch you want to merge into the master) branch to the master
git merge dev
5. View status
git status
The output is as follows: It means that there are 6 submissions that need to be merged.
On branch master Your branch is ahead of 'origin/master' by 6 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean
6. Push to the remote master (master permission is required)
git push origin master
problem:
1. The prompts for executing git merge dev are as follows:
merge: dev - not something we can merge
possible reason:
1. There is really nothing to merge
2. The branch name is wrong, check it.
So far this article on the detailed explanation of the process steps of Git merge branch is introduced here.