git status时发现有未提交的事件提交发现Git 锁文件冲突的问题解决办法
遇到类似的问题可以参照这种方式,不一定是提交的文件是跟我一样的,有可能也有其他的
On branch develop
Your branch is up to date with 'origin/develop'.Changes not staged for commit:(use "git add <file>..." to update what will be committed)(use "git restore <file>..." to discard changes in working directory)modified: .gitignoremodified: .idea/AUTOProjectDemo.imlmodified: .idea/misc.xmlno changes added to commit (use "git add" and/or "git commit -a")
尝试直接添加git add。.提交之后也发现错误:
> 不能提交fatal: Unable to create 'D:/workspaces/autoprojectdemo/.git/index.lock': File exists.Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.
解决办法:在 PyCharm 终端中直接执行:
rm .git/index.lock
然后后面再继续添加发现是可以了
直接提交,不打开编辑器
git add .
git commit -m “chore: 更新项目配置和gitignore”
问题排查发现是因为:
Git 锁文件冲突的问题