Your local changes to the following files would be overwritten by checkout

at小涛

关注

阅读 99

2022-06-06

当我们切换项目分支时,有时候会提示:
Your local changes to the following files would be overwritten by checkout_git

当前分支有未跟踪的文件,checkout 命令会覆盖它们,请缓存( stash )或者提交( commit )

解决办法

所以我们可以先commit,然后再切换分支即可

原因

git 的本地版本管理有三个部分

名称

说明

工作区(Working Directory)

我们直接编辑的文件部分

暂存区(Staged Snapshot)

文件执行 ​​git add .​​ 后存的地方

版本库区 (Commit History)

文件执行 ​​git commit .​​ 后存的地方

它们三个的关系是这样样子的:

Your local changes to the following files would be overwritten by checkout_版本库_02


精彩评论(0)

0 0 举报