Git之checkout到别的分支提示Your local changes to the following files would be overwritten by checkout:
生活随笔
收集整理的這篇文章主要介紹了
Git之checkout到别的分支提示Your local changes to the following files would be overwritten by checkout:
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
1 問(wèn)題
在我自己的分支,然后切換到主分支,提示錯(cuò)誤如下
Your local changes to the following files would be overwritten by checkout:****file****file?
?
?
?
2 解決辦法
先把這些文件進(jìn)行add操作,然后再進(jìn)行commit,就可以了,
git add filegit commit -m 'commit message'?
然后你就可以切換分支了,如果你后面再需要切換到這個(gè)分支來(lái)了之后,因?yàn)槟阋呀?jīng)git commit了,如果文件是你不想要的,你可以還原git commit操作,命令如下
git reset HEAD~如果你想了解更多的撤銷git add或則commit或修改了源文件進(jìn)行還原操作,請(qǐng)參考我的這篇博客
Git撤銷文件的修改(git checkout -- file)(git reset HEAD file)(git reset HEAD~)
?
?
?
總結(jié)
以上是生活随笔為你收集整理的Git之checkout到别的分支提示Your local changes to the following files would be overwritten by checkout:的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: Git之添加公钥之后git clone
- 下一篇: React Native之通过creat