gitlab和github 和码云 代码提交总结(原理和命令几乎一样)

1.git合并的时候,冲突问题Merging is not possible because you have unmerged files

**原因 :是因为你的文件合并没有处理好
解决问题:git diff :查看你的所有没有合并的待处理文件

  1. 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是本地分支,第二个是远程分支

总结完毕

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值