Solve the git problem: fatal: Need to specify how to reconcile divergent branches.

It may appear when using git to pull remote projects

fatal: Need to specify how to reconcile divergent branches. 如图:

 Solution:

Step 1: Delete the local branch.

git branch -d 分支名称

If the above cannot be deleted, simply click to delete it forcibly

git branch -D 分支名称

Appears after deletion is complete

Remember, you cannot delete the current branch, you need to switch branches

Extension: delete remote branch

git push origin --delete 远程分支名称

Switch branch instructions:

git checkout 分支名称

 The local conflicting branch can be deleted after the switch is successful

Step 2: Pull the deleted branch remotely

git fetch origin 分支名称

The branch name of Switched to a new branch appears to indicate successful pull.

Of course, after you delete the branch, you can also use git pull directly, depending on your personal situation.

 After that, the code can be successfully git pull

Guess you like

Origin blog.csdn.net/weixin_51220967/article/details/127870602