1. After changing the code, git push error occurs
Note: At this point, use git pull: to update the code, git will automatically merge different updates,
a. If git automatically merges successfully, then git push operation will be successful.
b. If git fails to automatically merge, use git status to check which file failed to merge, you need to manually modify the conflicting place, then perform git add git commit operation, and then git push
But, after this method is submitted, merge: ******************** will be displayed in the submission record, and git rebase can solve this problem and solve Methods as below
2. git branch mywork: create a new branch (git branch view all branches)
At this point, the modified content is reflected in the mywork branch
3. git log: View local commits
4. Roll back your own commits (on the master branch, at this time the mywork branch retains the changes)
a. git reset: roll back your own commit
b. git checkout: restore the modified content
5. git pull: synchronize the latest code
6. git checkout mywork: switch to the mywork branch
7. git rebase master: synchronize the master update to the mywork branch
Note: This step is the most important, git will automatically merge master branch and mywork molecule at this time
a. If the automatic merge is successful, don't worry about it
b. If the automatic merge fails, git status will check which file the merge failed, open the file, manually modify the conflict, and execute git add filename -> git rebase --continue
8. Under the git log view, the branch is submitted locally
9. git checkout master: switch to the master branch
10. git rebase mywork merges the latest code of mywork to master
11. git push -u origin submit. At this point, merge will not appear: ********************
12. The operation flow chart is as follows