1.git合并的时候,冲突问题Merging is not possible because you have unmerged files
**原因 :是因为你的文件合并没有处理好
解决问题:git diff :查看你的所有没有合并的待处理文件
- If you have fixed the conflicts you need to add the files to the stage with git add [filename], then commit as normal.
**原因 :当你发现自己的代码install也行,项目启动也没大问题,就有可能是你没有执行一个步骤
解决问题:git add . 和 git commit -m “提交信息” 没做,其实就是这个代码提示的If you have fixed the conflicts you need to add the files to the stage with git add [filename], then commit as normal的中文翻译.
3. 当我git pull时(之前pull成功,现在是在我合并代码后为了防止有人又提交所以就又pull了一次)提示error:commit your changes or stash them before you can merge.
**原因:是因为你没有提交:修改有冲突的代码过以后一般我们会add一下,这时pull就会报这个错
解决:方案1 直接git commit -m " "
方案2 : git stash -> git pull ->git stash pop
4. git push 提示 ! [rejected] dev -> dev (non-fast-forward) 并提示: [master| MERGEING]
最佳解决方案:
1 git fetch origin dev // 获取远程 dev 分支的修
2 git merge origin dev // 合并远程 dev 分支
(我在这卡了报错,参考最上面1 的解决方法)
3 git pull origin dev // 更新本地的代码
注:我在使用的时候在 2 这里卡住了原因就是我最上面说的那个问题,只要这个问题解决了就没有问题了****
---------------2020/03/11-补充----------------------------------------------
在和远端pull时:
refusing to merge unrelated histories
本地仓库和远程不是通过colone下来的,会发生仓库不一致问题
解决:
1 git pull origin master --allow-unrelated-histories
2 git push origin master:master
这第一master是本地分支,第二个是远程分支
总结完毕