Git :git checkout 报错 error: Your local changes to the following files would be overwritten by checkout
- 2020-06-02 14:47:00
- IDO老徐 原創
- 19623
很多初學者,經常會遇到類似如下的錯誤:
[root@istester istester_idoxu6]# git
checkout master
error: Your local changes to the following files would be overwritten by checkout:
idoxu.ini
Please commit your changes or stash them before you switch branches.
Aborting
解决 ,
1、提交更新,再切换分支 ;
執行如下,
[root@istester istester_idoxu6]# git add *
[root@istester istester_idoxu6]# git commit -m "isTester"
[istester/21day ecff84c] 111
1 file changed, 1 insertion(+)
[root@istester istester_idoxu6]# git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[root@istester istester_idoxu6]#
2、也可以强制切换分支 ,
執行如下,
[root@istester istester_idoxu6]# git checkout master
error: Your local changes to the following files would be overwritten by checkout:
idoxu.ini
Please commit your changes or stash them before you switch branches.
Aborting
[root@istester istester_idoxu6]# git checkout -f master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[root@istester istester_idoxu6]# git branch
istester/21day
istester/git21day
* master
[root@istester istester_idoxu6]#
IDO老徐
全网同名,个人IP公衆號
日更10年,每天 1 分钟、解决 1 个问题
職場、副業、輕創業、寫作、個人IP
公衆號、視頻號、小红书、知乎
長按/掃碼,關注IDO老徐
關注回複 401 送你「十年原創资料包」
聯系人: | IDO老徐 |
---|---|
Email: | 957863300@qq.com |
QQ: | 957863300 |
微信: | 957863300 |
微博: | isTester |
網址: | idoxu.com |
地址: | 中国 · 广东 · 深圳 |
來源備注:老徐博客