Git conflict resolution (reproduced)

Source: Internet
Author: User
Gerrit will not resolve the conflict. If two people change the same row of a file at the same time, the conflict will occur, you will see the review in progress and there will be your change cocould not be merged due to a path conflict at the bottom. If a remote conflict is resolved on the conflicting submitter Machine
CD demogit fetch origingit rebase origin/develop modify the conflicting file git Add. Git rebase -- continuegit push origin does not generate new changes records. You can submit the original changes Review records to git pull.
If a remote conflict is resolved on another machine
The CD demo uses the branch develop as an example to open the website in which Gerrit conflicts, such as http: // 192.168.1.33: 8080/#/C/16/find the download command and execute git fetch SSH: // [email protected]: 29418/demo refs/changes/16/16/1 & git checkout fetch_headgit checkout-B new_branch_namegit fetch origingit rebase origin/develop modify the conflicting file git add. git rebase -- continuegit push origin new_branch_name: refs/For/developgit checkout developgit branch-D new_branch_name will not generate new changes record, submit the original changes Review review, in this case, pull conflicts locally on the original conflicting machine, and git reset -- hard head ^ is required. Otherwise, cannot do a partial commit during a merge occurs. finally, update the code git pull.
Additional reading: Undo previous commitgit revert head undo all local modifications git reset -- hard undo all local to previous modifications git reset -- hard head ^

1. Click "Publish and submit" in Gerrit and the prompt is as follows:

Your change cocould not be merged due to a path conflict.

Please merge (or rebase) The change locally and upload the resolution for review.

 

2. The solution is as follows:

 

Cd ~ /Projects/PAN # Switch to the GIT branch of the pan project # view the GIT checkout master # select the GIT fetch origin of the branch # The difference between fetch and pull. Search for the difference ~ Git rebase origin/master # Check the location where "Conflict (content):" is available. After the conflict is resolved manually, go to git add DEV/controller/web/index. PHP # this is just an example. You need to add the GIT rebase -- continue git push origin head: refs/For/master # OK first.

 

After git push, you need to review it again in Gerrit.

 

3. For more information about git, Gerrit, and Hudson (3)-Git tips

Although I still have some doubts about git, anyway and the conflict are resolved.

Reference: http://johnshen0708.iteye.com/blog/1487760

Http://rubyist.marsz.tw/blog/2012-01-17/git-reset-and-revert-to-rollback-commit/

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.