git 合并分支笔记

  1. 查看分支

    zhoumengkang@OSX10111-3c15c2ba060a:~/IdeaProjects/php/atatech-org$ git branch
      develop
    * newui
      test

下面将把newui的修改合并到develop分支中去。

  1. 切换分支

    zhoumengkang@OSX10111-3c15c2ba060a:~/IdeaProjects/php/atatech-org$ git checkout develop
    Switched to branch 'develop'
    Your branch is up-to-date with 'origin/develop'.
  2. 合并分支

    zhoumengkang@OSX10111-3c15c2ba060a:~/IdeaProjects/php/atatech-org$ git merge newui
    ...
    Auto-merging xxx.php
    ...
    CONFLICT (modify/delete): xxx/ActivityAdd.php deleted in newui and modified in HEAD. Version HEAD of xxx/ActivityAdd.php left in tree.
    ...
    Automatic merge failed; fix conflicts and then commit the result.
  3. 查看冲突

    zhoumengkang@OSX10111-3c15c2ba060a:~/IdeaProjects/php/atatech-org$ git status
    On branch develop
    Your branch is up-to-date with 'origin/develop'.
    You have unmerged paths.
      (fix conflicts and run "git commit")
    
    Changes to be committed:
    
            modified:   xxx.md
            new file:   xxx.twig
            ...
    
    Unmerged paths:
      (use "git add/rm ..." as appropriate to mark resolution)
    
            both modified:   xxx.php
            deleted by them: xxx.php
    
    Untracked files:
      (use "git add ..." to include in what will be committed)
    
            vendor/composer/LICENSE
    
    zhoumengkang@OSX10111-3c15c2ba060a:~/IdeaProjects/php/atatech-org$
  4. 处理冲突

手动修改Unmerged paths的文件,解决冲突,然后在添加到git中。

联系我们

邮箱 626512443@qq.com
电话 18611320371(微信)
QQ群 235681453

Copyright © 2015-2024

备案号:京ICP备15003423号-3