报错问题
例如在一个Vue项目中,多人协作开发,src/pages/index/index.vue
这个文件已被另一位协作者修改过并提交到了远端仓库,并且你也在本地修改了这个文件,此时如果你去执行git pull
的话是会报错的,错误如下:
error: Your local changes to the following files would be overwritten by merge:
src/pages/index/index.vue
Please, commit your changes or stash them before you can merge.
解决方法
执行以下命令即可:
git stash // 将所有本地修改隐藏起来
git pull // 拉取远端仓库代码
git stash pop // 将隐藏的修改放出来