git:如何还原.gitignore中的文件[致命:通过的空提交集] [英] git: how to revert file which is in .gitignore [fatal: empty commit set passed]
问题描述
我的.gitignore文件具有以下行
My .gitignore file has the following line
vendor/
我已修改了vendor文件夹内的文件. 现在,当我通过执行-
I have modified a file inside the vendor folder. Now when I do update my bundles by performing -
bin/vendors install
- 我看到以下消息
捆绑包名称"具有本地修改.请再次提交或还原/推送它们,然后再次运行此命令.
"Bundle name" has local modifications. Please commit or revert/push them before running this command again.
我意识到我不应该更改捆绑软件中的任何内容,而是试图纠正该错误.
I realize that I should have not changed anything in bundles and am trying to correct that mistake.
当我尝试通过发出命令还原文件时:
When I try to revert the file by issuing the command:
git revert <path>/<filename>.twig
我收到此错误消息
致命:传递了空提交集
fatal: empty commit set passed
git rm
也不起作用.
如何安装我的捆绑软件?
How can I make my bundle install?
推荐答案
您可以执行以下任一操作:
You can do either:
-
将更改后的文件恢复为初始状态:
Revert the file you changed to its initial state:
git checkout path/to/file
删除vendor/
目录,然后再次运行bin/vendors install
.这样,您就可以确保一切都是新的.
Remove the vendor/
directory and run bin/vendors install
again. That way you are sure everything is new.
经验法则是,从不切勿修改vendor/
目录中的文件.
A rule of thumb of thumb is that should NEVER modify files in the vendor/
directory.
希望有帮助!
这篇关于git:如何还原.gitignore中的文件[致命:通过的空提交集]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!