zoukankan      html  css  js  c++  java
  • git解决冲突的方法

    1.

    You are not currently on a branch, so I cannot use any

    症状:有一次pull的时候又出现冲突,这回用“git reset --hard FETCH_HEAD”方法都不行了,出现:

    $ git pull
    You are not currently on a branch, so I cannot use any
    'branch.<branchname>.merge' in your configuration file.
    Please specify which remote branch you want to use on the command
    line and try again (e.g. 'git pull <repository> <refspec>').
    See git-pull(1) for details.
    解决方法:

    首先git checkout -b temp

    其次git checkout master

    即可恢复到master repository的状态,然后就可以pull了

    2.

    使用Git时,在pull、merge、rebase的过程中,经常会遇到conflict的情况。

    遇到conflict时,以上处理过程会终端,并且命令行中显示(xxx|MERGING)的状态(Windows下Git Bash中显示的状态)。

    命令行下解决冲突的方法为:

    使用任意的文本编辑工具编辑有冲突的文件,去除冲突标记(就是>>>>>>>> ======= <<<<<<这样的东西),并把文本冲突解决掉。

    然后使用git add 有冲突的文件,这时文件的冲突标记就变成了修改标记了(在windows下安装TortoiseGit就能看到文件图标的变化了)。

    将所有有冲突的文件解决完后,使用git commit -a -m "Xxx"提交就算完成整个合并过程了。

  • 相关阅读:
    Anaconda+用conda创建python虚拟环境
    Linux安装matlab及简单操作
    Matlab2016b 版本knnclassify函数在Matlab2019b的替换及解决方案
    WIN TO GO实现win10系统迁移
    ArcMap高版本文件保存成低版本
    matlab 保存大于2GB数据
    Tensorflow_gpu + anconda3_3.4.2 +keras2.1.1 + CUDA8.0+CUDNN5.1
    B
    A
    POJ I Think I Need a Houseboat
  • 原文地址:https://www.cnblogs.com/rootfaker/p/6729255.html
Copyright © 2011-2022 走看看