找到并替换后Git重置失败

找到并替换后Git重置失败

本文介绍了找到并替换后Git重置失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

没有git的命令正在工作,创建了一个分支,做了一些提交。然后我做了递归查找并替换为:

  LANG = C查找。 -type'f -name'*。*'-exec sed -i''s / My \ sentence / My \ sentencevotre / {} + 

哪些工作正常,但现在我不能提交,我不能重置硬盘,重置时有一系列消息:
error:packfile .git / objects /pack/pack-$SHA.pack不符合索引
...



以及提交时:

warning:packfile .git / objects / pack / pack- $ SHA.pack无法访问
....
错误:无效对象100644 $'Doxyfile'$ SHA
错误:构建树时出错



我该如何管理它?

解决方案

撤消找到并替换,然后重试。也许你足够幸运了......否则使用你的备份。



下次更加小心你的.git目录。


No git's command is working anymore created a branch, made some commits. Then I made a recursive find and replace as so :

LANG=C find . -type f -name '*.*' -exec sed -i '' s/My\ sentence/My\ sentencevotre/ {} +

which worked properly, but now I can't commit, I can't reset hard, I have a serie of messages when reseting :error: packfile .git/objects/pack/pack-$SHA.pack does not match index...

and when commiting :

warning: packfile .git/objects/pack/pack-$SHA.pack cannot be accessed....error: invalid object 100644 $SHA for 'Doxyfile'error: Error building trees

How can I manage this ?

解决方案

Undo your find and replace and try again. Maybe you are lucky enough ... otherwise use your backup.

Be more careful with your .git directory next time.

这篇关于找到并替换后Git重置失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:19