git 提交出现error: Your local changes to the following files would be overwritten by checkout

简介:

在提交代码时,直接在master分支push了,而原来的testdemo分支没有merge,这样提交过后会报错

error: Your local changes to the following files would be overwritten by checkout:
        app/Http/Controllers/UsersController.php
Please commit your changes or stash them before you switch branches.
Aborting

提示的是当前改变文件会被覆盖,出现这个问题,我们需要让master回退到上一个版本

git reset --hard 版本号

此时,在使用git merge testdemo分支即可。

git merge testdemo

合并完testdemo分支后,我们再次push即可。

git push
目录
相关文章
|
3月前
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
299 1
|
4月前
|
编译器 网络安全 开发工具
git学习五:切换本地仓库出现的问题。修改git配置初始化。error:src refspec master does not match any。错误总结,送上几个案例
这篇文章是关于Git使用中遇到的一些问题及其解决方案的总结,包括切换本地仓库时的问题、修改Git初始化配置、以及解决"error: src refspec master does not match any"错误等。
136 0
|
5月前
|
开发工具 git 索引
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
|
8月前
|
开发工具 git
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
|
8月前
|
开发工具 git
git error 已解决【Another git process seems to be running in this repository, e.g. an editor opened by】
git error 已解决【Another git process seems to be running in this repository, e.g. an editor opened by】
127 2
|
8月前
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
944 1
|
9月前
|
缓存 开发工具 git
Git Cloning into :error: RPC failed
Git Cloning into :error: RPC failed
132 0
|
开发工具 git
Git_错误_03_ Git提交时显示用户 unknown
这是因为没有设置用户名 $ git config --global user.name "your_name" $ git config --global user.email "your_email@youremail.com"
1265 0
|
27天前
|
Java 网络安全 开发工具
Git进阶笔记系列(01)Git核心架构原理 | 常用命令实战集合
通过本文,读者可以深入了解Git的核心概念和实际操作技巧,提升版本管理能力。
|
28天前
|
网络安全 开发工具 git
mac git clone命令提示git@gitee.com: Permission denied (publickey).问题修复
mac git clone命令拉取gitee上项目代码时提示密钥问题

相关实验场景

更多