我如何解决失败的git提交? [英] How do I fix a failed git commit?

查看:86
本文介绍了我如何解决失败的git提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的 git ,并且正在尝试提交,但我被卡在 vi 之类的内容中我不熟悉。我设法摆脱它,但我认为我走错了路,因为我的git状态显示变化没有上演,但我仍然无法再尝试。有人能告诉我,我能做些什么来修复仍在悬挂的流程并提交我的更改吗?



这里是错误

 致命:无法创建'/.git/index.lock':存在文件。 
如果当前没有其他git进程正在运行,这可能意味着
git进程在之前的版本库中崩溃。确保没有其他的git
进程正在运行,并手动删除文件以继续。

不是我拿出完整路径

一如既往感谢您的帮助。

解决方案

假设您目前没有对git进行任何操作(即,因为任何原因在存储库中推或拉或运行git脚本),您可以手动删除锁定文件并再次尝试。



另外,git期望描述您的更改的提交消息。假设您不希望编辑器打开,您可以使用 -m 选项提供内嵌消息:

  git commit -am改变了这一点,那另一件事


I am new to git and was trying to commit, but I got stuck in what looked like vi which I'm not familiar with. I managed to get out of it, but I think I got out the wrong way because my git status says "changes not staged," but I still can't try again. Could someone tell me what I can do to fix the still hanging process and commit my changes?

here is the error

fatal: Unable to create '/.git/index.lock': File exists.
If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

not i took out the full path

As always thanks for your help.

解决方案

Assuming you're not doing anything with git at the moment (i.e., not doing a push or pull or running a git script in the repository, for any reason), you could just remove the lock file manually and try again.

Also, git expects a "commit message" describing your changes. Assuming you don't want an editor to open, you can provide an inline message using the -m option:

git commit -am "Changed this, that, and the other thing"

这篇关于我如何解决失败的git提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆