git提交代码从reject到提交成功全过程

  • 1. 问题重述
  • 2. 解决过程
    • 出现新问题:Your local changes to the following files would be overwritten by merge
    • 出现新问题:Merging is not possible because you have unmerged files
    • 出现新问题:SystemMeanageService爆红
    • 出现新问题:You have not concluded your merge (MERGE_HEAD exists).

这里是不断发芽的山有木兮,希望这个帖子可以帮到你!

1. 问题重述

git提交出现“updates were rejected because a pushed branch tip is behind its remote”

git报错如下:

09:01:59.572: [LCIntelligenceFusionSystem] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/cxd:develop --tags
error: failed to push some refs to 'ssh://git.piesat.cn:27022/hezhipeng/LCIntelligenceFusionSystem.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
To ssh://git.piesat.cn:27022/hezhipeng/LCIntelligenceFusionSystem.git
hint: counterpart. Check out this branch and integrate the remote changes
!   refs/heads/cxd:refs/heads/develop   [rejected] (non-fast-forward)
hint: (e.g. 'git pull ...') before pushing again.
Done
hint: See the 'Note about fast-forwards' in 'git push --help' for details.Updates were rejected because a pushed branch tip is behind its remote

2. 解决过程


pull之后,还是拒绝,好像不对
换个帖子

我要推送的不是master是develop,所以把master换成develop

接着我git pull
提示BaseEntity被change了。

出现新问题:Your local changes to the following files would be overwritten by merge

报错如下:

 Your local changes to the following files would be overwritten by merge

解决办法:
根据是否要保存本地修改,有以下两种解决方案
1 保留修改

执行以下三条命令

  git stash #封存修改git pull origin master git stash pop #把修改还原

注:
git stash:备份当前工作区内容,从最近的一次提交中读取相关内容,让工作区保证和上次提交的内容一致。同时,将当前工作区内容保存到Git栈中
git pull:拉取服务器上当前分支代码
git stash pop:从Git栈中读取最近一次保存的内容,恢复工作区相关内容。同时,用户可能进行多次stash操作,需要保证后stash的最先被取到,所以用栈(先进后出)来管理;pop取栈顶的内容并恢复
git stash list:显示Git栈内的所有备份,可以利用这个列表来决定从那个地方恢复。
git stash clear:清空Git栈

2 废弃修改

核心思想就是版本回退,具体命令如下

  git reset --hard git pull origin master

不建议使用第二种。除非你再三确定不需要本地的修改了。

我们使用第一种方法
我查看一下状态

git status

尝试merge,发现无法合并,右下角显示merging develop

出现新问题:Merging is not possible because you have unmerged files

报错如下:

error: Merging is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

解决办法:

用git diff或者git status 查看哪些文件冲突,有冲突的会提示:

++<<<<<<< HEAD

++<<<<<<< new_branch

修改你的冲突的文件,修改完之后,保存。
用git add xxx,把你修改的文件全部都添加进去。
最后,用git commit -a -m ” 备注信息 ” 提交,完成。

出现新问题:SystemMeanageService爆红

删掉了里面的<<<之类的还是红色

在我不知道咋办的时候
弹出一个窗,我也不知道我怎么触发的
然后我就把SystemMeanageService回滚了,确实只有这个是爆红的
回滚之后,不在出现红色,尝试提交代码

还是尝试合并代码

出现新问题:You have not concluded your merge (MERGE_HEAD exists).

Please, commit your changes before you merge.
他的意思是我还有没提交的,想合并,需要自己提交
提交成功
去gitlab查看

从git提交出现“updates were rejected because a pushed branch tip is behind its remote”到提交成功解决问题的过程相关推荐

  1. git上传代码报错:hint: Updates were rejected because a pushed branch tip is behind its remote hint: counter

    1.报错 error: failed to push some refs to 'http://xxx/backend.git' hint: Updates were rejected because ...

  2. git push报错: nt: Updates were rejected because a pushed branch tip is behind its remote

    git push   dv  v3:master 出现这错误 nt: Updates were rejected because a pushed branch tip is behind its r ...

  3. hint: Updates were rejected because a pushed branch tip is behind its remote

    参考:https://stackoverflow.com/questions/25729190/how-to-fix-issue-in-git-updates-were-rejected-becaus ...

  4. 【小5聊】TortoiseGit代码管理之hint: Updates were rejected because a pushed branch tip is behind its remote

    1.出现这个原因之一,由于各种各样的原因,本地的代码比分支的代码要旧 2.解决方法就是,先获取分支的代码,再提交到分支

  5. git push.default Update were rejected because a pushed branch tip is behand remote

    现象:可以git pull下来,然后再git status,显示正常. 通过浏览器访问git地址,发现没有别人提交的修改,最新修改是自己提交的. 咨询同事,给出一个命令,就搞定可以正常push了. g ...

  6. err: git push.default Update were rejected because a pushed branch tip is behand remote

    解决方法一: git config --global push.default current 解决方法二: 切换到其他分支,并执行 git pull,全部更新完毕,在切换回原来的分支,再执行git ...

  7. Git提交失败之 Updates were rejected because the tip of your current branch is behind

    错误显示 D:\devworkspace\ecpphoton\jcodef>git push To https://github.com/osxm/jcodef.git! [rejected] ...

  8. git提交远程报错[rejected] master - master (fetch first)

    1 先下载git for windows 然后一直点下一步安装. 2 安装之后,选择git gui.生成ssh 链接 git 公钥. 用命令也可以: $ ssh-keygen -t rsa -C &q ...

  9. Git工作笔记004---torisegit使用时Updates were rejected because the tip of your current branch i

    JAVA技术交流QQ群:170933152 因为要跟别的公司一块合作开发,我们用svn他们用git,现在又得用git 我在提交的时候:报如下错误: git.exe push --progress &q ...

最新文章

  1. module ‘open3d‘ has no attribute ‘PointCloud‘
  2. java:提示Could not initialize class sun.awt.X11GraphicsEnvironment
  3. 美图笔试算法题(两个人拿石头判断输赢)
  4. kali锁屏后无法唤醒_面试官:说一下公平锁和非公平锁的区别?
  5. linux里强制覆盖,Linux cp命令无法强制覆盖
  6. MySQL二十八规范数据库设计
  7. ‘Microsoft Office Enterprise 2007 在安装过程中出错‘ 的解决方法
  8. 转子系统动力学模型matlab程序代码
  9. 帝国cms内容页模版
  10. OSChina 周四乱弹 —— 不要生气!我不要生气!
  11. win10网络显示已连接到服务器异常,w10 网络连接配置异常如何修复
  12. 关于计算机的发展史手抄报图片,历史手抄报精选图片内容
  13. 技巧分享—截图录屏 FSCapture
  14. 最近很火火火火的 GitHub 项目
  15. VOT中的EAO评判指标
  16. VS Code语言切换
  17. [Python] 散点图(二维散点图、三维散点图、散点图矩阵)
  18. 关于年份和月份的计算
  19. 伯凡日知录--一万小时定律(第一天更新)
  20. 微信小程序转盘demo

热门文章

  1. 记一次买到假芯片的经历
  2. 新加坡风险投资公司将投资1000万美元建立加密货币区块链投资基金
  3. webx的一些不解解惑
  4. SAP之Suse For SAP 12 sp5安装教程(超详细)
  5. 微信小程序实现人脸识别注册登录
  6. Arduino寄存器(PWM)
  7. [Android][设置最小(大)宽高]
  8. C语言程序设计-简易文本编辑器
  9. 青龙新毛----快音
  10. Navigation组件的使用详解