[Git]解决GIT冲突问题:git pull failed
2023-09-27 14:24:41 时间
1 文由
花了很长时间一次性修改了项目的一大堆文件,准备最后git pull同步一下本地仓库代码,再一次性git commit,git push新代码的。
but天不遂人愿,git pull时产生冲突(git pull failed),并提示了具体的冲突源码文件1份。
此时,特别害怕辛辛苦苦编写/修改好几小时的源码刹那间灰飞烟灭,还怕对先前旧有代码造成不可知的破坏。
那可咋整?
莫急。
2 解决过程
step0 拷贝当前源码一份,以作灾备。[若对自己的GIT操作不自信时,可采取此下下策]
step1 暂存本地仓库修改的代码
stash: 贮存。git stash可先将开发者的改动暂存到本地仓库中,随时可以取出来再用,但是不用担心下次push到服务器时,把不想提交的改动也push到服务器上,因为Stash Changes的内容不参与commit和push。
git stash
step2 同步远程仓库代码到本地仓库
git pull
step3 将暂存的本地代码取出,置入当前工作空间
git stash pop
step4 直接提交当前工作空间中修改后的源码到本地仓库
git commit -am "commit message..."
step5 推送本地仓库源码至远程仓库
git push
3 参考文献
相关文章
- from PyQt5.QtWidgets import QApplication ImportError: DLL load failed: 拒绝访问。
- 【神经网络与深度学习】Caffe训练执行时爆出的Check failed: registry.count(t ype) == 1 (0 vs. 1) Unknown layer type
- git报错:Auto Merge Failed; Fix Conflicts and Then Commit
- Failed to convert property value of type ‘null‘ to required type ‘double‘ for property ‘balance‘解决方案
- SharePoint 2013 workflows stop working (Failed on started.)
- git error: failed to push some refs to 'git@github.com:xxx/xxx.git'
- 启动Myeclipse报错“Failed to create the Java Virtual Machine”的解决办法
- jnhs-netbeans maven Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project
- jnhs解决办法部署错误: 未能启动 Tomcat, 服务器端口 8080 已在使用中。Web server failed to start. Port 8080 was already in use.
- CentOS 安装 VirtualBox,启动虚拟机失败 Failed to open a session.
- CentOS6.5 重启网络报错:Bringing up interface eth0: Error: Connection activation failed: Device not managed by NetworkManager or unavailable
- 如何解决failed to push some refs to git
- 【Git】git clone 报错:fatal: index-pack failed 解决办法
- docker离线安装 启动报错Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
- 启动mysql,爆出错误:Job for mysqld.service failed because the control process exited with error code.
- 运维 —— IMP-00030: failed to create file import_sys for write
- apt-get update --> Bad header line (fresh install) Ign http://archive.ubuntu.com natty-security/multiverse Sources/DiffIndex W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/natty/Rele
- git clone时RPC failed; curl 18 transfer closed with outstanding read data remaining
- android - INSTALL_FAILED_MEDIA_UNAVAILABLE
- vue——qiankun环境,vue-cli3子项目本地启动,element无法显示字体和图标,控制台提示:Failed to decode downloaded font: http://localhost:9000/child/xxx-front/font...
- git push 时发生 error: failed to push some refs to 错误 (解决办法)