This is the 12th day of my participation in the August Text Challenge.More challenges in August

Git base operation, commit rollback guide, Git base operation, storage guide, based on the former two basic can normal development work, but always have a backfire, this article will mainly describe the remote Git merge conflict how to deal with

Remote branch merge conflict

As you can see, I had a code conflict when I merged the remote dev branch into the master branch:

The solution

The main solution is to pull the remote merged target branch to the local development branch, handle the conflict locally, and then submit it to the remote development branch

Pull the target branch to the local development branch to resolve the conflict

Pull the target branch to the local development branch to resolve the conflict Pull the remote target branch (master) onto the local dev branch (dev) and merge the remote latest code with the local dev branch (dev). The editor will merge the remote latest code with the local dev branch, requiring us to resolve the conflict manually

Git pull origin master // because I have a code conflict with the remote master, so I need to pull down the remote master and merge the local code. Not a cookie-cutter master!!Copy the code

Results:

Resolve the conflict
  • When you open a conflicting file, you’ll see a screen like the one below, and you can choose from a variety of options, from quick fixes to manually deleting the code (remember to remove the special tokens as well). Git with < < < < < < <, = = = = = = = > > > > > > > tag out the content of the different branches, remember to put these symbols deleted.

  • The processing result is as follows, I directly use the local version as the main, remember to save after operation

  • Then add, commit, and push the conflicting files to the remote branch (dev)

  • Now let’s look at the status of the merge on the remote branch. It no longer shows a conflict, so the conflict is resolved.

The summary of this chapter

If there is anything wrong with this article, please correct it. Thank you 😄