git gitlab resolve conflicts using commit code

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

Copyright statement: This article is an original article by the blogger and may not be reproduced without the blogger's permission. https://blog.csdn.net/sea_snow/article/details/53388894
 
Another: use git fetch origin --prune after commit and then git rebase -i refs/remotes/origin/master 
or (not recommended) git merge origin/master -v
Finally resolve conflicts manually using git add then git rebase --continue 
Finally use git push origin refs/heads/master:flin-002 
Then trigger the branch self-check pipeline to verify code compilation, and then submit mergeRequest  
Waiting for someone else to verify the merge using git lab
 
 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324951267&siteId=291194637