Git conflict resolution

Source: Internet
Author: User
Tags git mergetool

Git resolves conflicts

  1. Install beyond compare 4

 

2. Configure the GIT comparison tool

# Difftool Configuration

Git config -- Global diff. Tool bc4

Git config -- Global difftool. bc4.cmd "\" C:/program files/beyond compare 4/bcomp.exe \ "\" $ Local \ "\" $ Remote \""

 

Git difftool head // compare the current Modification

# Mergeftool Configuration

Git config -- Global merge. Tool bc4

Git config -- Global mergetool. bc4.cmd "\" C: /program files/beyond compare 4/bcomp.exe \ "\" $ Local \ "\" $ Remote \ "\" $ base \ "\" $ merged \""

Git config -- Global mergetool. bc4.trustexitcode true

 

 

# Prevent git mergetool from generating backup files (*. orig)

Git config -- Global mergetool. keepbackup false

 

  1. Job branch merge conflict resolution

1. Undo the task branch code on the target Branch

1) switch to the target Branch

Git checkout G4

Git pull

2) check whether the task branch code on the target Branch has been merged.

Git log-oneline-grep = "E00P00-123"

3) if the task has been merged, undo the task code and submit it.

Git revert-no-commit $ (GIT log-pretty = "% H"-grep = "E00P00-123 ")

Git commit-m "XXX E00P00-123 XXXXXXXXX # task code undo"

Skip this step if there are no merged or undo conflicts

 

2. Merge the task branches to the target branches.

Git merge-squash origin/E00P00-123

3. If a merge conflict exists, the conflict will be resolved.

1) view conflicting files

Git status

2) Open the merge tool.

Git mergetool

3) resolve the conflict after the BC interface appears

4. Submit the code after resolving the conflict

Git commit-M 'xxx E00P00-123 xxxxx"

  1. Push Branch

Git push

  1. Merge conflicts between integration branches, develop, and Master branches (take Integration Branch G3 and develop branch as an example)

1. Merge integration branches to develop

Git checkout develop

Git pull

Git merge-no-commit origin/G3

2. If there is a conflict, use the comparison tool to solve the conflict (same as the merge task branch solution)

Git mergetool

3. Submit the code after resolving the conflict.

Git commit-m "XXX E00P00-124 xxxxxx" (with the release task title as the commit log)

4. Push Branch

Git push

 

Git conflict resolution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.