git覆盖文件

环境

有两台服务器,一台测试服务器,一台生产服务器,一台编写代码的PC,在代码库只上传核心代码,但是由于有可能核心代码可能增多就出现问题,直接修改.gitignore之后,add+commit之后另一台服务器下载的过程中会覆盖原来的代码,强制执行会error,这个时候需要进行如下操作

具体操作

If you want remove all local changes from your working copy, simply stash them:

git stash save --keep-index
git pull

If you don't need them anymore, you now can drop that stash:

git stash drop

git stash可以把当前工作现场“储藏”起来,等以后恢复现场后继续工作:

具体链接请看廖雪峰老师的博客 http://www.liaoxuefeng.com/