Explain the process steps of GIT merging branches in detail

Time:2021-4-7

Normally merge branch dev to master process:
(merged into other branches, similar to HA)

1. The dev branch to be merged first updates and submits all files

Note: if you don’t need to submit localization modification files, you’d better not submit them. A temporary backup is then deleted or withdrawn.
Enter the project root directory and execute:

git add .
Git commit - M 'Submit files for all dev branches'
git push -u origin dev

2. Switch to master branch


git checkout master

3. Update the master code to the latest version


git pull origin master

4. Merge the code of the dev branch into the master


git merge dev

5. View status


git status

The output is as follows: it indicates that there are 6 submissions to merge.

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 remote master (Master permission required)


git push origin master

Question:
1. The prompt for executing git merge dev is as follows:


merge: dev - not something we can merge

Possible reasons:

  • There’s really nothing to merge
  • Wrong branch name, check it.

Here is the article about the process steps of GIT merging branches. For more information about git merging branches, please search previous articles of developer or continue to browse the following articles. I hope you can support developer more in the future!