zoukankan      html  css  js  c++  java
  • git冲突处理

    7/26/2017 10:48:43 AM @Jzedy

    git冲突解决

    内容冲突处理

    1. merge

      A对文件1进行改动提交到远程,在之前B也对文件1进行了改动且提交了。如在相同行都做了修改,出现push失败

      解决方法:A先pull远程,若自动合并失败会提示合并冲突于文件1,修改文件1冲突后push
      git pull->git diff->merge->git commit -am "msg"->git push

    2. stash

      A对于文件1先不想提交,可以先stash当前状态,pull远程,还原stash(参见上一篇git学习中bug分支使用),有冲突解决冲突,在提交

      git stash->git pull->git stash pop->merge->git commit -am "msg"->git push

    树冲突

    当A对文件1命名修改为a提交远程,在之前B也对文件1命名修改为b且先提交了,这时出现merge冲突

    解决方法:

    • 使用git mergetool 出现

      Deleted merge conflict for ‘gitstudy’:
      {local}: deleted
      {remote}: created file
      Use (c)reated or (d)eleted file, or (a)bort?

      选择c保留需要的文件,选择d删除不要的文件

    • git status->git add/rm <file>->git commit

      首先git status 查看状态,的到

      • 由我们添加:a
      • 由他们添加:b
      • 双方删除:文件1

    此时若A确定了命名为a,则git rm 文件1->git rm b->git add a->git commit

    解决了冲突后就可以提交了。

  • 相关阅读:
    这个 bug 让我更加理解 Spring 单例了
    SpringBoot
    codeblocks笔记
    https://docs.platformio.org/en/latest/boards/index.html
    外部存储的烧写
    嵌入式AI
    python的一些库
    语音芯片及解决方案
    神奇的调试值“DEADBEEF”
    【12月】+我与rt_thread的“江湖恩怨”
  • 原文地址:https://www.cnblogs.com/JzedyBlogs/p/9368662.html
Copyright © 2011-2022 走看看