Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在将其推送到上游之前,我不小心删除了其中一个目录中的 gitignore 文件。有没有办法从命令行重新创建该文件?
该.gitignore文件与版本控制下的任何其他文件没有什么不同。如果您想从 取回它HEAD,只需执行(无论它在哪里)
.gitignore
HEAD
git checkout -- .gitignore
如果您在将文件添加到索引或提交之前删除了该文件,很遗憾它会丢失,您必须重新创建它(使用您最喜欢的文本编辑器)。