git忽略vim临时文件

编程入门 行业动态 更新时间:2024-10-14 14:15:44
本文介绍了git忽略vim临时文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使git忽略所有目录中vim产生的临时文件(无论是在整个系统中,还是在本地为单个项目),正确的方法是什么? 解决方案

Vim临时文件以〜结尾,因此您可以添加到文件 .gitignore 行

*〜

Vim还创建交换文件有swp和swo扩展名。

*。swp * .swo

这会忽略单个项目中的所有vim临时文件

如果你想要在全球范围内完成此操作,您可以在家中创建一个.gitignore文件(可以指定其他名称或位置),然后使用以下命令:

git config --global core.excludesfile〜/ .gitignore

然后你需要将要忽略的文件添加到该文件中。

What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?

解决方案

Vim temporary files end with ~ so you can add to the file .gitignore the line

*~

Vim also creates swap files that have the swp and swo extensions. to remove those use the lines:

*.swp *.swo

This will ignore all the vim temporary files in a single project

If you want to do it globally, you can create a .gitignore file in your home (you can give it other name or location), and use the following command:

git config --global core.excludesfile ~/.gitignore

Then you just need to add the files you want to ignore to that file

更多推荐

git忽略vim临时文件

本文发布于:2023-07-06 07:39:43,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:临时文件   git   vim

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!