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:
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
1 問題
在我自己的分支,然后切換到主分支,提示錯誤如下
Your local changes to the following files would be overwritten by checkout:****file****file?
?
?
?
2 解決辦法
先把這些文件進行add操作,然后再進行commit,就可以了,
git add filegit commit -m 'commit message'?
然后你就可以切換分支了,如果你后面再需要切換到這個分支來了之后,因為你已經(jīng)git commit了,如果文件是你不想要的,你可以還原git commit操作,命令如下
git reset HEAD~如果你想了解更多的撤銷git add或則commit或修改了源文件進行還原操作,請參考我的這篇博客
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:的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Git之添加公钥之后git clone
- 下一篇: React Native之通过creat