Git rebase Resolve commit conflict

Source: Internet
Author: User

1. After changing the code, GIT push has an error



Note: At this point, use git pull: Update the code, GIT will automatically merge different updates,

A. If git succeeds in automating the merge, then the GIT push operation will succeed.

B. If git fails automatically, you can use Git status to see which file merge failed, need to manually modify the conflict place, then git add git commit, and then git push


But, when this method is submitted, the merge is displayed in the submission record: *********************, and Git rebase solves the problem, as follows


2. Git branch mywork: New branch (Git branch View all branches)

At this point, the modified content is reflected in the MyWork branch.


3. Git log: View local submission


4. Rollback your submission (on the master branch, at which point the MyWork branch retains the change)

A. Git Reset: Rewind your submission

b. Git checkout: Restoring modified content


5, git Pull: Sync the latest code


6, git checkout mywork: Switch to MyWork branch

7, git rebase master: Update master, sync to MyWork branch

Note: This step, is most important, git will automatically merge Master branch and MyWork molecule at this time

A. If the automatic merge succeeds, don't worry about it.

B. If automatic merge fails, git status looks at which file merge failed, opens the file, modifies the conflict manually, executes the git add filename-> git rebase--continue

8, git log view, branch local submission



9. Git checkout master: Switch to Master branch

10. Git rebase mywork to merge mywork latest code into master


11, Git push-u origin submit. At this point, there will be no merger: *******************

12, Operation flow chart, as follows


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.