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
目录
相关文章
|
29天前
|
开发工具 git 索引
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
$ git revert -m v1.0.21 6003eb5f5b455f0a3dfb74f48f63878e7 error: option `mainline' expect
|
11天前
|
编译器 网络安全 开发工具
git学习五:切换本地仓库出现的问题。修改git配置初始化。error:src refspec master does not match any。错误总结,送上几个案例
这篇文章是关于Git使用中遇到的一些问题及其解决方案的总结,包括切换本地仓库时的问题、修改Git初始化配置、以及解决"error: src refspec master does not match any"错误等。
27 0
|
4月前
|
开发工具 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‘
73 1
|
4月前
|
开发工具 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】
65 2
|
4月前
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
399 1
|
5月前
|
缓存 开发工具 git
Git Cloning into :error: RPC failed
Git Cloning into :error: RPC failed
87 0
|
5月前
|
开发工具 git
If you are using the git profile, you need to set a Git URI in your configuration. If you are using
If you are using the git profile, you need to set a Git URI in your configuration. If you are using
127 0
|
2月前
|
存储 开发工具 git
|
2月前
|
开发工具 git
【GIT 第二篇章】GIT常用命令
Git常用命令涵盖初始化、状态管理、提交、分支处理、远程操作等关键流程。`git init`启动本地仓库,`git clone`下载远程仓库。通过`git status`和`git diff`检查工作状态与差异。利用`git add`暂存文件,`git commit`保存更改。借助`git branch`、`git checkout`、`git merge`和`git rebase`管理分支。使用`git fetch`、`git pull`和`git push`同步远程仓库。通过`git reset`、`git revert`和`git checkout`实现版本回退。
60 0
|
11天前
|
开发工具 git
git学习四:常用命令总结,包括创建基本命令,分支操作,合并命令,压缩命令,回溯历史命令,拉取命令
这篇文章是关于Git常用命令的总结,包括初始化配置、基本提交、分支操作、合并、压缩历史、推送和拉取远程仓库等操作的详细说明。
47 1
git学习四:常用命令总结,包括创建基本命令,分支操作,合并命令,压缩命令,回溯历史命令,拉取命令

相关实验场景

更多