Principle: First extract all changes of the current branch from the switch branch to the latest commit, apply the dev branch to the latest branch, and delete the branch's commit content
Implementation process:
The initial state is as follows, with two branches, one master and one develop. At this time, HEAD is at (6.added hello.txt file). Now execute git rebase develop
Before git rebase
After git rebase
Summary : After the content of the newly created branch is merged into the latest submission of the master, and applied, all the submissions of the branch are deleted.
go merge
Principle: merge two branches and generate a new commit
Implementation process:
Assuming that the HEAD of git is at 6.added hello.txt file, the latest commit of the master branch, execute git merge develop at this time, and the results are as follows:
Merge process : Git will automatically find the node of the new dev branch from the master branch (the common starting point for cutting branches). At this time, merge, git will identify the latest commit on the master and dev branches, and the identified changes will form a new one Submit, as 7. Merge branch'develop'
Summary : Merge is to identify all changes in the starting and ending points of the branch and the main branch that are requested to be merged, and generate a new commit