[openstack]Merge conflict怎么处理

之前给社区提了一个patch过了一段时间后,出现了merge confict的问题。这里不得不说openstack的文档真是好。

Resolving merge conflicts

  

If the change that you submitted has a merge conflict, you need to manually resolve it using git rebase.

Rebasing is used to integrate changes from one branch into another to resolve conflicts when multiple commits happen on the same file.

 

 
Warning

 

Never do a rebase on public (master) branches.

  1. You submit a change.

  2. Somebody else submits a change and that change merges. Now your change has a merge conflict.

  3. Update your local repository:

    $ git remote update
    $ git pull --ff-only origin master
    
  4. Download your change:

    $ git review -d $PARENT_CHANGE_NUMBER
    
  5. Rebase your change:

    $ git rebase origin/master
    
  6. Resolve conflicts manually:

    Conflicts are marked in a file with clear line breaks:

    <<<<<<< HEAD
    Second line.
    =======
    Third line.
    >>>>>>> feature/topic branch.
    

    <<<<<<<: Indicates the start of the lines that had a merge conflict.

    =======: Indicates separation of the two conflicting changes.

    >>>>>>>: Indicates the end of the lines that had a merge conflict.

    You need to resolve a conflict by manually editing the file. You also need to delete the ‘<<<<<<<’, ‘=======’, and’>>>>>>>’ in the file.

  7. Add the files to the stage:

    $ git add $FILENAME
    
  8. Complete the rebase process:

    $ git rebase --continue
    
  9. Send the rebased patch again for review:

    $ git review

posted on 2016-11-25 17:14  剑客西门吹雪  阅读(1550)  评论(0编辑  收藏  举报

导航